weld SvxCharNamePage
Change-Id: Ia54a5ac4fe4a11b7c03508c336193bb52c616e7f
diff --git a/cui/source/inc/chardlg.hxx b/cui/source/inc/chardlg.hxx
index 6a5f2b5..fa5c91c 100644
--- a/cui/source/inc/chardlg.hxx
+++ b/cui/source/inc/chardlg.hxx
@@ -94,57 +94,58 @@
struct SvxCharNamePage_Impl;
class SvxCharNamePage : public SvxCharBasePage
class SvxCharNamePage : public CharBasePage
{
friend class VclPtr<SvxCharNamePage>;
private:
static const sal_uInt16 pNameRanges[];
VclPtr<VclContainer> m_pWestFrame;
VclPtr<FixedText> m_pWestFontNameFT;
VclPtr<FontNameBox> m_pWestFontNameLB;
VclPtr<FixedText> m_pWestFontStyleFT;
VclPtr<FontStyleBox> m_pWestFontStyleLB;
VclPtr<FixedText> m_pWestFontSizeFT;
VclPtr<FontSizeBox> m_pWestFontSizeLB;
VclPtr<FixedText> m_pWestFontLanguageFT;
VclPtr<SvxLanguageComboBox> m_pWestFontLanguageLB;
VclPtr<FixedText> m_pWestFontTypeFT;
VclPtr<PushButton> m_pWestFontFeaturesButton;
VclPtr<VclContainer> m_pEastFrame;
VclPtr<FixedText> m_pEastFontNameFT;
VclPtr<FontNameBox> m_pEastFontNameLB;
VclPtr<FixedText> m_pEastFontStyleFT;
VclPtr<FontStyleBox> m_pEastFontStyleLB;
VclPtr<FixedText> m_pEastFontSizeFT;
VclPtr<FontSizeBox> m_pEastFontSizeLB;
VclPtr<FixedText> m_pEastFontLanguageFT;
VclPtr<SvxLanguageBox> m_pEastFontLanguageLB;
VclPtr<FixedText> m_pEastFontTypeFT;
VclPtr<PushButton> m_pEastFontFeaturesButton;
VclPtr<VclContainer> m_pCTLFrame;
VclPtr<FixedText> m_pCTLFontNameFT;
VclPtr<FontNameBox> m_pCTLFontNameLB;
VclPtr<FixedText> m_pCTLFontStyleFT;
VclPtr<FontStyleBox> m_pCTLFontStyleLB;
VclPtr<FixedText> m_pCTLFontSizeFT;
VclPtr<FontSizeBox> m_pCTLFontSizeLB;
VclPtr<FixedText> m_pCTLFontLanguageFT;
VclPtr<SvxLanguageBox> m_pCTLFontLanguageLB;
VclPtr<FixedText> m_pCTLFontTypeFT;
VclPtr<PushButton> m_pCTLFontFeaturesButton;
std::unique_ptr<SvxCharNamePage_Impl> m_pImpl;
SvxCharNamePage( vcl::Window* pParent, const SfxItemSet& rSet );
std::unique_ptr<weld::Widget> m_xWestFrame;
std::unique_ptr<weld::Label> m_xWestFontNameFT;
std::unique_ptr<weld::ComboBoxText> m_xWestFontNameLB;
std::unique_ptr<weld::Label> m_xWestFontStyleFT;
std::unique_ptr<SvtFontStyleBox> m_xWestFontStyleLB;
std::unique_ptr<weld::Label> m_xWestFontSizeFT;
std::unique_ptr<SvtFontSizeBox> m_xWestFontSizeLB;
std::unique_ptr<weld::Label> m_xWestFontLanguageFT;
std::unique_ptr<LanguageBox> m_xWestFontLanguageLB;
std::unique_ptr<weld::Label> m_xWestFontTypeFT;
std::unique_ptr<weld::Button> m_xWestFontFeaturesButton;
std::unique_ptr<weld::Widget> m_xEastFrame;
std::unique_ptr<weld::Label> m_xEastFontNameFT;
std::unique_ptr<weld::ComboBoxText> m_xEastFontNameLB;
std::unique_ptr<weld::Label> m_xEastFontStyleFT;
std::unique_ptr<SvtFontStyleBox> m_xEastFontStyleLB;
std::unique_ptr<weld::Label> m_xEastFontSizeFT;
std::unique_ptr<SvtFontSizeBox> m_xEastFontSizeLB;
std::unique_ptr<weld::Label> m_xEastFontLanguageFT;
std::unique_ptr<LanguageBox> m_xEastFontLanguageLB;
std::unique_ptr<weld::Label> m_xEastFontTypeFT;
std::unique_ptr<weld::Button> m_xEastFontFeaturesButton;
std::unique_ptr<weld::Widget> m_xCTLFrame;
std::unique_ptr<weld::Label> m_xCTLFontNameFT;
std::unique_ptr<weld::ComboBoxText> m_xCTLFontNameLB;
std::unique_ptr<weld::Label> m_xCTLFontStyleFT;
std::unique_ptr<SvtFontStyleBox> m_xCTLFontStyleLB;
std::unique_ptr<weld::Label> m_xCTLFontSizeFT;
std::unique_ptr<SvtFontSizeBox> m_xCTLFontSizeLB;
std::unique_ptr<weld::Label> m_xCTLFontLanguageFT;
std::unique_ptr<LanguageBox> m_xCTLFontLanguageLB;
std::unique_ptr<weld::Label> m_xCTLFontTypeFT;
std::unique_ptr<weld::Button> m_xCTLFontFeaturesButton;
SvxCharNamePage(TabPageParent pParent, const SfxItemSet& rSet);
void Initialize();
const FontList* GetFontList() const;
void UpdatePreview_Impl();
void FillStyleBox_Impl( const FontNameBox* rBox );
void FillSizeBox_Impl( const FontNameBox* rBox );
void FillStyleBox_Impl(const weld::Widget& rBox);
void FillSizeBox_Impl(const weld::Widget& rBox);
enum LanguageGroup
{
@@ -164,13 +165,12 @@
void Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp );
bool FillItemSet_Impl( SfxItemSet& rSet, LanguageGroup eLangGrp );
DECL_LINK( UpdateHdl_Impl, Timer *, void );
DECL_LINK( FontModifyEditHdl_Impl, Edit&, void );
DECL_LINK( FontModifyListBoxHdl_Impl, ListBox&, void );
DECL_LINK( FontModifyComboBoxHdl_Impl, ComboBox&, void );
DECL_LINK(FontFeatureButtonClicked, Button*, void);
DECL_LINK(UpdateHdl_Impl, Timer *, void );
DECL_LINK(FontModifyEditHdl_Impl, weld::Entry&, void);
DECL_LINK(FontModifyComboBoxHdl_Impl, weld::ComboBoxText&, void);
DECL_LINK(FontFeatureButtonClicked, weld::Button&, void);
void FontModifyHdl_Impl(void const *);
void FontModifyHdl_Impl(const weld::Widget&);
public:
using SfxTabPage::ActivatePage;
diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx
index d92db5c..e5d3bda 100644
--- a/cui/source/options/optdict.cxx
+++ b/cui/source/options/optdict.cxx
@@ -105,7 +105,7 @@
// display languages
m_xLanguageLB->SetLanguageList(SvxLanguageListFlags::ALL, true, true);
m_xLanguageLB->SelectEntryPos(0);
m_xLanguageLB->set_active(0);
}
IMPL_LINK_NOARG(SvxNewDictionaryDialog, OKHdl_Impl, weld::Button&, void)
@@ -140,7 +140,7 @@
}
// create and add
LanguageType nLang = m_xLanguageLB->GetSelectedLanguage();
LanguageType nLang = m_xLanguageLB->get_active_id();
try
{
// create new dictionary
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index e8183ec..e5cc4d2 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -266,12 +266,12 @@
Idle m_aUpdateIdle;
OUString m_aNoStyleText;
std::unique_ptr<FontList> m_pFontList;
sal_Int32 m_nExtraEntryPos;
int m_nExtraEntryPos;
bool m_bInSearchMode;
SvxCharNamePage_Impl() :
m_nExtraEntryPos( COMBOBOX_ENTRY_NOTFOUND ),
m_bInSearchMode ( false )
SvxCharNamePage_Impl()
: m_nExtraEntryPos(std::numeric_limits<int>::max())
, m_bInSearchMode(false)
{
m_aUpdateIdle.SetPriority( TaskPriority::LOWEST );
@@ -280,10 +280,34 @@
// class SvxCharNamePage -------------------------------------------------
SvxCharNamePage::SvxCharNamePage( vcl::Window* pParent, const SfxItemSet& rInSet )
: SvxCharBasePage(pParent, "CharNamePage", "cui/ui/charnamepage.ui", rInSet)
SvxCharNamePage::SvxCharNamePage(TabPageParent pParent, const SfxItemSet& rInSet)
: CharBasePage(pParent, "cui/ui/charnamepage.ui", "CharNamePage", rInSet)
, m_pImpl(new SvxCharNamePage_Impl)
, m_xEastFrame(m_xBuilder->weld_widget("asian"))
, m_xEastFontNameFT(m_xBuilder->weld_label("eastfontnameft"))
, m_xEastFontNameLB(m_xBuilder->weld_combo_box_text("eastfontnamelb"))
, m_xEastFontStyleFT(m_xBuilder->weld_label("eaststyleft"))
, m_xEastFontStyleLB(new SvtFontStyleBox(m_xBuilder->weld_combo_box_text("eaststylelb")))
, m_xEastFontSizeFT(m_xBuilder->weld_label("eastsizeft"))
, m_xEastFontSizeLB(new SvtFontSizeBox(m_xBuilder->weld_combo_box_text("eastsizelb")))
, m_xEastFontLanguageFT(m_xBuilder->weld_label("eastlangft"))
, m_xEastFontLanguageLB(new LanguageBox(m_xBuilder->weld_combo_box_text("eastlanglb")))
, m_xEastFontTypeFT(m_xBuilder->weld_label("eastfontinfo"))
, m_xEastFontFeaturesButton(m_xBuilder->weld_button("east_features_button"))
, m_xCTLFrame(m_xBuilder->weld_widget("ctl"))
, m_xCTLFontNameFT(m_xBuilder->weld_label("ctlfontnameft"))
, m_xCTLFontNameLB(m_xBuilder->weld_combo_box_text("ctlfontnamelb"))
, m_xCTLFontStyleFT(m_xBuilder->weld_label("ctlstyleft"))
, m_xCTLFontStyleLB(new SvtFontStyleBox(m_xBuilder->weld_combo_box_text("ctlstylelb")))
, m_xCTLFontSizeFT(m_xBuilder->weld_label("ctlsizeft"))
, m_xCTLFontSizeLB(new SvtFontSizeBox(m_xBuilder->weld_combo_box_text("ctlsizelb")))
, m_xCTLFontLanguageFT(m_xBuilder->weld_label("ctllangft"))
, m_xCTLFontLanguageLB(new LanguageBox(m_xBuilder->weld_combo_box_text("ctllanglb")))
, m_xCTLFontTypeFT(m_xBuilder->weld_label("ctlfontinfo"))
, m_xCTLFontFeaturesButton(m_xBuilder->weld_button("ctl_features_button"))
{
m_xPreviewWin.reset(new weld::CustomWeld(*m_xBuilder, "preview", m_aPreviewWin));
m_pImpl->m_aNoStyleText = CuiResId( RID_SVXSTR_CHARNAME_NOSTYLE );
SvtLanguageOptions aLanguageOptions;
@@ -293,61 +317,48 @@
if (bShowNonWestern)
{
get(m_pWestFrame, "western");
get(m_pWestFontNameFT, "westfontnameft-cjk");
get(m_pWestFontNameLB, "westfontnamelb-cjk");
get(m_pWestFontStyleFT, "weststyleft-cjk");
get(m_pWestFontStyleLB, "weststylelb-cjk");
get(m_pWestFontSizeFT, "westsizeft-cjk");
get(m_pWestFontSizeLB, "westsizelb-cjk");
m_xWestFrame = m_xBuilder->weld_widget("western");
m_xWestFontNameFT = m_xBuilder->weld_label("westfontnameft-cjk");
m_xWestFontNameLB = m_xBuilder->weld_combo_box_text("westfontnamelb-cjk");
m_xWestFontStyleFT = m_xBuilder->weld_label("weststyleft-cjk");
m_xWestFontSizeFT = m_xBuilder->weld_label("westsizeft-cjk");
get(m_pWestFontLanguageFT, "westlangft-cjk");
get(m_pWestFontLanguageLB, "westlanglb-cjk");
get(m_pWestFontTypeFT, "westfontinfo-cjk");
m_xWestFontStyleLB.reset(new SvtFontStyleBox(m_xBuilder->weld_combo_box_text("weststylelb-cjk")));
m_xWestFontSizeLB.reset(new SvtFontSizeBox(m_xBuilder->weld_combo_box_text("westsizelb-cjk")));
get(m_pWestFontFeaturesButton, "west_features_button-cjk");
m_xWestFontLanguageFT = m_xBuilder->weld_label("westlangft-cjk");
m_xWestFontLanguageLB.reset(new LanguageBox(m_xBuilder->weld_combo_box_text("westlanglb-cjk")));
m_xWestFontTypeFT = m_xBuilder->weld_label("westfontinfo-cjk");
m_xWestFontFeaturesButton = m_xBuilder->weld_button("west_features_button-cjk");
}
else
{
get(m_pWestFrame, "simple");
get(m_pWestFontNameFT, "westfontnameft-nocjk");
get(m_pWestFontNameLB, "westfontnamelb-nocjk");
get(m_pWestFontStyleFT, "weststyleft-nocjk");
get(m_pWestFontStyleLB, "weststylelb-nocjk");
get(m_pWestFontSizeFT, "westsizeft-nocjk");
get(m_pWestFontSizeLB, "westsizelb-nocjk");
m_xWestFrame = m_xBuilder->weld_widget("simple");
m_xWestFontNameFT = m_xBuilder->weld_label("westfontnameft-nocjk");
m_xWestFontStyleFT = m_xBuilder->weld_label("weststyleft-nocjk");
m_xWestFontSizeFT = m_xBuilder->weld_label("westsizeft-nocjk");
get(m_pWestFontLanguageFT, "westlangft-nocjk");
get(m_pWestFontLanguageLB, "westlanglb-nocjk");
get(m_pWestFontTypeFT, "westfontinfo-nocjk");
m_xWestFontLanguageFT = m_xBuilder->weld_label("westlangft-nocjk");
m_xWestFontLanguageLB.reset(new LanguageBox(m_xBuilder->weld_combo_box_text("westlanglb-nocjk")));
m_xWestFontTypeFT = m_xBuilder->weld_label("westfontinfo-nocjk");
get(m_pWestFontFeaturesButton, "west_features_button-nocjk");
m_xWestFontFeaturesButton = m_xBuilder->weld_button("west_features_button-nocjk");
std::unique_ptr<weld::EntryTreeView> xWestFontNameLB = m_xBuilder->weld_entry_tree_view("namegrid", "westfontname-nocjk", "westfontnamelb-nocjk");
std::unique_ptr<weld::EntryTreeView> xWestFontStyleLB = m_xBuilder->weld_entry_tree_view("stylegrid", "weststyle-nocjk", "weststylelb-nocjk");
std::unique_ptr<weld::EntryTreeView> xWestFontSizeLB = m_xBuilder->weld_entry_tree_view("sizegrid", "westsize-nocjk", "westsizelb-nocjk");
// 8 lines in the treeview
xWestFontNameLB->set_height_request_by_rows(8);
xWestFontStyleLB->set_height_request_by_rows(8);
xWestFontSizeLB->set_height_request_by_rows(8);
m_xWestFontNameLB = std::move(xWestFontNameLB);
m_xWestFontStyleLB.reset(new SvtFontStyleBox(std::move(xWestFontStyleLB)));
m_xWestFontSizeLB.reset(new SvtFontSizeBox(std::move(xWestFontSizeLB)));
}
get(m_pEastFrame, "asian");
get(m_pEastFontNameFT, "eastfontnameft");
get(m_pEastFontNameLB, "eastfontnamelb");
get(m_pEastFontStyleFT, "eaststyleft");
get(m_pEastFontStyleLB, "eaststylelb");
get(m_pEastFontSizeFT, "eastsizeft");
get(m_pEastFontSizeLB, "eastsizelb");
get(m_pEastFontLanguageFT, "eastlangft");
get(m_pEastFontLanguageLB, "eastlanglb");
get(m_pEastFontTypeFT, "eastfontinfo");
get(m_pEastFontFeaturesButton, "east_features_button");
get(m_pCTLFrame, "ctl");
get(m_pCTLFontNameFT, "ctlfontnameft");
get(m_pCTLFontNameLB, "ctlfontnamelb");
get(m_pCTLFontStyleFT, "ctlstyleft");
get(m_pCTLFontStyleLB, "ctlstylelb");
get(m_pCTLFontSizeFT, "ctlsizeft");
get(m_pCTLFontSizeLB, "ctlsizelb");
get(m_pCTLFontLanguageFT, "ctllangft");
get(m_pCTLFontLanguageLB, "ctllanglb");
get(m_pCTLFontTypeFT, "ctlfontinfo");
get(m_pCTLFontFeaturesButton, "ctl_features_button");
//In MacOSX the standard dialogs name font-name, font-style as
//Family, Typeface
//In GNOME the standard dialogs name font-name, font-style as
@@ -359,42 +370,30 @@
#else
OUString sFontFamilyString(CuiResId(RID_SVXSTR_CHARNAME_FAMILY));
#endif
m_pWestFontNameFT->SetText(sFontFamilyString);
m_pEastFontNameFT->SetText(sFontFamilyString);
m_pCTLFontNameFT->SetText(sFontFamilyString);
m_xWestFontNameFT->set_label(sFontFamilyString);
m_xEastFontNameFT->set_label(sFontFamilyString);
m_xCTLFontNameFT->set_label(sFontFamilyString);
#ifdef MACOSX
OUString sFontStyleString(CuiResId(RID_SVXSTR_CHARNAME_TYPEFACE));
#else
OUString sFontStyleString(CuiResId(RID_SVXSTR_CHARNAME_STYLE));
#endif
m_pWestFontStyleFT->SetText(sFontStyleString);
m_pEastFontStyleFT->SetText(sFontStyleString);
m_pCTLFontStyleFT->SetText(sFontStyleString);
m_xWestFontStyleFT->set_label(sFontStyleString);
m_xEastFontStyleFT->set_label(sFontStyleString);
m_xCTLFontStyleFT->set_label(sFontStyleString);
m_pWestFrame->Show();
m_pEastFrame->Show(bShowCJK);
m_pCTLFrame->Show(bShowCTL);
m_xWestFrame->show();
m_xEastFrame->show(bShowCJK);
m_xCTLFrame->show(bShowCTL);
get(m_pPreviewWin, "preview");
m_pWestFontLanguageLB->SetLanguageList(SvxLanguageListFlags::WESTERN, true, false, true);
m_pEastFontLanguageLB->SetLanguageList(SvxLanguageListFlags::CJK, true, false, true);
m_pCTLFontLanguageLB->SetLanguageList(SvxLanguageListFlags::CTL, true, false, true);
if (!bShowNonWestern)
{
//10 lines
sal_Int32 nHeight = m_pWestFontSizeLB->CalcWindowSizePixel(10);
m_pWestFontNameLB->set_height_request(nHeight);
m_pWestFontStyleLB->set_height_request(nHeight);
m_pWestFontSizeLB->set_height_request(nHeight);
}
m_xWestFontLanguageLB->SetLanguageList(SvxLanguageListFlags::WESTERN, true, false, true);
m_xEastFontLanguageLB->SetLanguageList(SvxLanguageListFlags::CJK, true, false, true);
m_xCTLFontLanguageLB->SetLanguageList(SvxLanguageListFlags::CTL, true, false, true);
Initialize();
}
SvxCharNamePage::~SvxCharNamePage()
{
disposeOnce();
@@ -403,41 +402,17 @@
void SvxCharNamePage::dispose()
{
m_pImpl.reset();
m_pWestFrame.clear();
m_pWestFontNameFT.clear();
m_pWestFontNameLB.clear();
m_pWestFontStyleFT.clear();
m_pWestFontStyleLB.clear();
m_pWestFontSizeFT.clear();
m_pWestFontSizeLB.clear();
m_pWestFontLanguageFT.clear();
m_pWestFontLanguageLB.clear();
m_pWestFontFeaturesButton.clear();
m_pWestFontTypeFT.clear();
m_pEastFrame.clear();
m_pEastFontNameFT.clear();
m_pEastFontNameLB.clear();
m_pEastFontStyleFT.clear();
m_pEastFontStyleLB.clear();
m_pEastFontSizeFT.clear();
m_pEastFontSizeLB.clear();
m_pEastFontLanguageFT.clear();
m_pEastFontLanguageLB.clear();
m_pEastFontTypeFT.clear();
m_pEastFontFeaturesButton.clear();
m_pCTLFrame.clear();
m_pCTLFontNameFT.clear();
m_pCTLFontNameLB.clear();
m_pCTLFontStyleFT.clear();
m_pCTLFontStyleLB.clear();
m_pCTLFontSizeFT.clear();
m_pCTLFontSizeLB.clear();
m_pCTLFontLanguageFT.clear();
m_pCTLFontLanguageLB.clear();
m_pCTLFontTypeFT.clear();
m_pCTLFontFeaturesButton.clear();
SvxCharBasePage::dispose();
m_xCTLFontStyleLB.reset();
m_xEastFontLanguageLB.reset();
m_xWestFontStyleLB.reset();
m_xCTLFontSizeLB.reset();
m_xEastFontSizeLB.reset();
m_xWestFontSizeLB.reset();
m_xWestFontLanguageLB.reset();
m_xPreviewWin.reset();
m_xCTLFontLanguageLB.reset();
m_xEastFontLanguageLB.reset();
CharBasePage::dispose();
}
void SvxCharNamePage::Initialize()
@@ -445,30 +420,29 @@
// to handle the changes of the other pages
SetExchangeSupport();
Link<Edit&,void> aLink = LINK( this, SvxCharNamePage, FontModifyEditHdl_Impl );
m_pWestFontNameLB->SetModifyHdl( aLink );
m_pWestFontStyleLB->SetModifyHdl( aLink );
m_pWestFontSizeLB->SetModifyHdl( aLink );
m_pWestFontLanguageLB->SetSelectHdl( LINK( this, SvxCharNamePage, FontModifyComboBoxHdl_Impl ) );
Link<weld::ComboBoxText&,void> aLink = LINK(this, SvxCharNamePage, FontModifyComboBoxHdl_Impl);
m_xWestFontNameLB->connect_changed(aLink);
m_xWestFontStyleLB->connect_changed(aLink);
m_xWestFontSizeLB->connect_changed(aLink);
m_xWestFontLanguageLB->connect_changed(aLink);
m_pWestFontFeaturesButton->SetClickHdl(LINK(this, SvxCharNamePage, FontFeatureButtonClicked));
m_xWestFontFeaturesButton->connect_clicked(LINK(this, SvxCharNamePage, FontFeatureButtonClicked));
m_pEastFontNameLB->SetModifyHdl( aLink );
m_pEastFontStyleLB->SetModifyHdl( aLink );
m_pEastFontSizeLB->SetModifyHdl( aLink );
m_pEastFontLanguageLB->SetSelectHdl( LINK( this, SvxCharNamePage, FontModifyListBoxHdl_Impl ) );
m_pEastFontFeaturesButton->SetClickHdl(LINK(this, SvxCharNamePage, FontFeatureButtonClicked));
m_xEastFontNameLB->connect_changed(aLink);
m_xEastFontStyleLB->connect_changed(aLink);
m_xEastFontSizeLB->connect_changed(aLink);
m_xEastFontLanguageLB->connect_changed(aLink);
m_xEastFontFeaturesButton->connect_clicked(LINK(this, SvxCharNamePage, FontFeatureButtonClicked));
m_pCTLFontNameLB->SetModifyHdl( aLink );
m_pCTLFontStyleLB->SetModifyHdl( aLink );
m_pCTLFontSizeLB->SetModifyHdl( aLink );
m_pCTLFontLanguageLB->SetSelectHdl( LINK( this, SvxCharNamePage, FontModifyListBoxHdl_Impl ) );
m_pCTLFontFeaturesButton->SetClickHdl(LINK(this, SvxCharNamePage, FontFeatureButtonClicked));
m_xCTLFontNameLB->connect_changed(aLink);
m_xCTLFontStyleLB->connect_changed(aLink);
m_xCTLFontSizeLB->connect_changed(aLink);
m_xCTLFontLanguageLB->connect_changed(aLink);
m_xCTLFontFeaturesButton->connect_clicked(LINK(this, SvxCharNamePage, FontFeatureButtonClicked));
m_pImpl->m_aUpdateIdle.SetInvokeHandler( LINK( this, SvxCharNamePage, UpdateHdl_Impl ) );
}
const FontList* SvxCharNamePage::GetFontList() const
{
if ( !m_pImpl->m_pFontList )
@@ -500,10 +474,10 @@
{
FontMetric calcFontMetrics( SvxFont& _rFont,
SvxCharNamePage const * _pPage,
const FontNameBox* _pFontNameLB,
const FontStyleBox* _pFontStyleLB,
const FontSizeBox* _pFontSizeLB,
const SvxLanguageBoxBase* _pLanguageLB,
const weld::ComboBoxText* _pFontNameLB,
const SvtFontStyleBox* _pFontStyleLB,
const SvtFontSizeBox* _pFontSizeLB,
const LanguageBox* _pLanguageLB,
const FontList* _pFontList,
sal_uInt16 _nFontWhich,
sal_uInt16 _nFontHeightWhich)
@@ -511,10 +485,10 @@
Size aSize = _rFont.GetFontSize();
aSize.setWidth( 0 );
FontMetric aFontMetrics;
OUString sFontName(_pFontNameLB->GetText());
OUString sFontName(_pFontNameLB->get_active_text());
bool bFontAvailable = _pFontList->IsAvailable( sFontName );
if (bFontAvailable || _pFontNameLB->IsValueChangedFromSaved())
aFontMetrics = _pFontList->Get( sFontName, _pFontStyleLB->GetText() );
if (bFontAvailable || _pFontNameLB->get_value_changed_from_saved())
aFontMetrics = _pFontList->Get(sFontName, _pFontStyleLB->get_active_text());
else
{
//get the font from itemset
@@ -537,21 +511,21 @@
// old value, scaled
long nHeight;
if ( _pFontSizeLB->IsPtRelative() )
nHeight = rOldItem.GetHeight() + PointToTwips( static_cast<long>(_pFontSizeLB->GetValue() / 10) );
nHeight = rOldItem.GetHeight() + PointToTwips( static_cast<long>(_pFontSizeLB->get_value() / 10) );
else
nHeight = static_cast<long>(rOldItem.GetHeight() * _pFontSizeLB->GetValue() / 100);
nHeight = static_cast<long>(rOldItem.GetHeight() * _pFontSizeLB->get_value() / 100);
// conversion twips for the example-window
aSize.setHeight(
ItemToControl( nHeight, _pPage->GetItemSet().GetPool()->GetMetric( _nFontHeightWhich ), FUNIT_TWIP ) );
}
else if ( !_pFontSizeLB->GetText().isEmpty() )
aSize.setHeight( PointToTwips( static_cast<long>(_pFontSizeLB->GetValue() / 10) ) );
else if ( !_pFontSizeLB->get_active_text().isEmpty() )
aSize.setHeight( PointToTwips( static_cast<long>(_pFontSizeLB->get_value() / 10) ) );
else
aSize.setHeight( 200 ); // default 10pt
aFontMetrics.SetFontSize( aSize );
_rFont.SetLanguage(_pLanguageLB->GetSelectedLanguage());
_rFont.SetLanguage(_pLanguageLB->get_active_id());
_rFont.SetFamily( aFontMetrics.GetFamilyType() );
_rFont.SetFamilyName( aFontMetrics.GetFamilyName() );
@@ -575,51 +549,60 @@
// Font
const FontList* pFontList = GetFontList();
FontMetric aWestFontMetric = calcFontMetrics(rFont, this, m_pWestFontNameLB,
m_pWestFontStyleLB, m_pWestFontSizeLB, m_pWestFontLanguageLB,
FontMetric aWestFontMetric = calcFontMetrics(rFont, this, m_xWestFontNameLB.get(),
m_xWestFontStyleLB.get(), m_xWestFontSizeLB.get(), m_xWestFontLanguageLB.get(),
pFontList, GetWhich(SID_ATTR_CHAR_FONT),
GetWhich(SID_ATTR_CHAR_FONTHEIGHT));
m_pWestFontTypeFT->SetText(pFontList->GetFontMapText(aWestFontMetric));
m_xWestFontTypeFT->set_label(pFontList->GetFontMapText(aWestFontMetric));
FontMetric aEastFontMetric = calcFontMetrics(rCJKFont, this, m_pEastFontNameLB,
m_pEastFontStyleLB, m_pEastFontSizeLB, m_pEastFontLanguageLB,
FontMetric aEastFontMetric = calcFontMetrics(rCJKFont, this, m_xEastFontNameLB.get(),
m_xEastFontStyleLB.get(), m_xEastFontSizeLB.get(), m_xEastFontLanguageLB.get(),
pFontList, GetWhich(SID_ATTR_CHAR_CJK_FONT),
GetWhich(SID_ATTR_CHAR_CJK_FONTHEIGHT));
m_pEastFontTypeFT->SetText(pFontList->GetFontMapText(aEastFontMetric));
m_xEastFontTypeFT->set_label(pFontList->GetFontMapText(aEastFontMetric));
FontMetric aCTLFontMetric = calcFontMetrics(rCTLFont,
this, m_pCTLFontNameLB, m_pCTLFontStyleLB, m_pCTLFontSizeLB,
m_pCTLFontLanguageLB, pFontList, GetWhich(SID_ATTR_CHAR_CTL_FONT),
this, m_xCTLFontNameLB.get(), m_xCTLFontStyleLB.get(), m_xCTLFontSizeLB.get(),
m_xCTLFontLanguageLB.get(), pFontList, GetWhich(SID_ATTR_CHAR_CTL_FONT),
GetWhich(SID_ATTR_CHAR_CTL_FONTHEIGHT));
m_pCTLFontTypeFT->SetText(pFontList->GetFontMapText(aCTLFontMetric));
m_xCTLFontTypeFT->set_label(pFontList->GetFontMapText(aCTLFontMetric));
m_pPreviewWin->Invalidate();
m_aPreviewWin.Invalidate();
}
void SvxCharNamePage::FillStyleBox_Impl( const FontNameBox* pNameBox )
void SvxCharNamePage::FillStyleBox_Impl(const weld::Widget& rNameBox)
{
const FontList* pFontList = GetFontList();
DBG_ASSERT( pFontList, "no fontlist" );
FontStyleBox* pStyleBox = nullptr;
SvtFontStyleBox* pStyleBox = nullptr;
OUString sFontName;
if ( m_pWestFontNameLB == pNameBox )
pStyleBox = m_pWestFontStyleLB;
else if ( m_pEastFontNameLB == pNameBox )
pStyleBox = m_pEastFontStyleLB;
else if ( m_pCTLFontNameLB == pNameBox )
pStyleBox = m_pCTLFontStyleLB;
if (m_xWestFontNameLB.get() == &rNameBox)
{
pStyleBox = m_xWestFontStyleLB.get();
sFontName = m_xWestFontNameLB->get_active_text();
}
else if (m_xEastFontNameLB.get() == &rNameBox)
{
pStyleBox = m_xEastFontStyleLB.get();
sFontName = m_xEastFontStyleLB->get_active_text();
}
else if (m_xCTLFontNameLB.get() == &rNameBox)
{
pStyleBox = m_xCTLFontStyleLB.get();
sFontName = m_xCTLFontNameLB->get_active_text();
}
else
{
SAL_WARN( "cui.tabpages", "invalid font name box" );
return;
}
pStyleBox->Fill( pNameBox->GetText(), pFontList );
pStyleBox->Fill(sFontName, pFontList);
if ( m_pImpl->m_bInSearchMode )
{
@@ -628,36 +611,40 @@
OUString aEntry = m_pImpl->m_aNoStyleText;
const sal_Char sS[] = "%1";
aEntry = aEntry.replaceFirst( sS, pFontList->GetBoldStr() );
m_pImpl->m_nExtraEntryPos = pStyleBox->InsertEntry( aEntry );
m_pImpl->m_nExtraEntryPos = pStyleBox->get_count();
pStyleBox->append_text( aEntry );
aEntry = m_pImpl->m_aNoStyleText;
aEntry = aEntry.replaceFirst( sS, pFontList->GetItalicStr() );
pStyleBox->InsertEntry( aEntry );
pStyleBox->append_text(aEntry);
}
}
void SvxCharNamePage::FillSizeBox_Impl( const FontNameBox* pNameBox )
void SvxCharNamePage::FillSizeBox_Impl(const weld::Widget& rNameBox)
{
const FontList* pFontList = GetFontList();
DBG_ASSERT( pFontList, "no fontlist" );
FontStyleBox* pStyleBox = nullptr;
FontSizeBox* pSizeBox = nullptr;
SvtFontStyleBox* pStyleBox = nullptr;
SvtFontSizeBox* pSizeBox = nullptr;
OUString sFontName;
if ( m_pWestFontNameLB == pNameBox )
if (m_xWestFontNameLB.get() == &rNameBox)
{
pStyleBox = m_pWestFontStyleLB;
pSizeBox = m_pWestFontSizeLB;
pStyleBox = m_xWestFontStyleLB.get();
pSizeBox = m_xWestFontSizeLB.get();
sFontName = m_xWestFontNameLB->get_active_text();
}
else if ( m_pEastFontNameLB == pNameBox )
else if (m_xEastFontNameLB.get() == &rNameBox)
{
pStyleBox = m_pEastFontStyleLB;
pSizeBox = m_pEastFontSizeLB;
pStyleBox = m_xEastFontStyleLB.get();
pSizeBox = m_xEastFontSizeLB.get();
sFontName = m_xEastFontNameLB->get_active_text();
}
else if ( m_pCTLFontNameLB == pNameBox )
else if (m_xCTLFontNameLB.get() == &rNameBox)
{
pStyleBox = m_pCTLFontStyleLB;
pSizeBox = m_pCTLFontSizeLB;
pStyleBox = m_xCTLFontStyleLB.get();
pSizeBox = m_xCTLFontSizeLB.get();
sFontName = m_xCTLFontNameLB->get_active_text();
}
else
{
@@ -665,60 +652,76 @@
return;
}
FontMetric _aFontMetric( pFontList->Get( pNameBox->GetText(), pStyleBox->GetText() ) );
FontMetric _aFontMetric(pFontList->Get(sFontName, pStyleBox->get_active_text()));
pSizeBox->Fill( &_aFontMetric, pFontList );
}
namespace
{
void FillFontNames(weld::ComboBoxText& rBox, const FontList& rList)
{
// insert fonts
rBox.freeze();
sal_uInt16 nFontCount = rList.GetFontNameCount();
for (sal_uInt16 i = 0; i < nFontCount; ++i)
{
const FontMetric& rFontMetric = rList.GetFontName(i);
rBox.append_text(rFontMetric.GetFamilyName());
}
rBox.make_sorted();
rBox.thaw();
}
}
void SvxCharNamePage::Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp )
{
FontNameBox* pNameBox = nullptr;
FixedText* pStyleLabel = nullptr;
FontStyleBox* pStyleBox = nullptr;
FixedText* pSizeLabel = nullptr;
FontSizeBox* pSizeBox = nullptr;
FixedText* pLangFT = nullptr;
SvxLanguageBoxBase* pLangBox = nullptr;
weld::ComboBoxText* pNameBox = nullptr;
weld::Label* pStyleLabel = nullptr;
SvtFontStyleBox* pStyleBox = nullptr;
weld::Label* pSizeLabel = nullptr;
SvtFontSizeBox* pSizeBox = nullptr;
weld::Label* pLangFT = nullptr;
LanguageBox* pLangBox = nullptr;
sal_uInt16 nWhich = 0;
switch ( eLangGrp )
{
case Western :
pNameBox = m_pWestFontNameLB;
pStyleLabel = m_pWestFontStyleFT;
pStyleBox = m_pWestFontStyleLB;
pSizeLabel = m_pWestFontSizeFT;
pSizeBox = m_pWestFontSizeLB;
pLangFT = m_pWestFontLanguageFT;
pLangBox = m_pWestFontLanguageLB;
pNameBox = m_xWestFontNameLB.get();
pStyleLabel = m_xWestFontStyleFT.get();
pStyleBox = m_xWestFontStyleLB.get();
pSizeLabel = m_xWestFontSizeFT.get();
pSizeBox = m_xWestFontSizeLB.get();
pLangFT = m_xWestFontLanguageFT.get();
pLangBox = m_xWestFontLanguageLB.get();
nWhich = GetWhich( SID_ATTR_CHAR_FONT );
break;
case Asian :
pNameBox = m_pEastFontNameLB;
pStyleLabel = m_pEastFontStyleFT;
pStyleBox = m_pEastFontStyleLB;
pSizeLabel = m_pEastFontSizeFT;
pSizeBox = m_pEastFontSizeLB;
pLangFT = m_pEastFontLanguageFT;
pLangBox = m_pEastFontLanguageLB;
pNameBox = m_xEastFontNameLB.get();
pStyleLabel = m_xEastFontStyleFT.get();
pStyleBox = m_xEastFontStyleLB.get();
pSizeLabel = m_xEastFontSizeFT.get();
pSizeBox = m_xEastFontSizeLB.get();
pLangFT = m_xEastFontLanguageFT.get();
pLangBox = m_xEastFontLanguageLB.get();
nWhich = GetWhich( SID_ATTR_CHAR_CJK_FONT );
break;
case Ctl :
pNameBox = m_pCTLFontNameLB;
pStyleLabel = m_pCTLFontStyleFT;
pStyleBox = m_pCTLFontStyleLB;
pSizeLabel = m_pCTLFontSizeFT;
pSizeBox = m_pCTLFontSizeLB;
pLangFT = m_pCTLFontLanguageFT;
pLangBox = m_pCTLFontLanguageLB;
pNameBox = m_xCTLFontNameLB.get();
pStyleLabel = m_xCTLFontStyleFT.get();
pStyleBox = m_xCTLFontStyleLB.get();
pSizeLabel = m_xCTLFontSizeFT.get();
pSizeBox = m_xCTLFontSizeLB.get();
pLangFT = m_xCTLFontLanguageFT.get();
pLangBox = m_xCTLFontLanguageLB.get();
nWhich = GetWhich( SID_ATTR_CHAR_CTL_FONT );
break;
}
const FontList* pFontList = GetFontList();
pNameBox->Fill( pFontList );
FillFontNames(*pNameBox, *pFontList);
const SvxFontItem* pFontItem = nullptr;
SfxItemState eState = rSet.GetItemState( nWhich );
@@ -726,14 +729,14 @@
if ( eState >= SfxItemState::DEFAULT )
{
pFontItem = static_cast<const SvxFontItem*>(&( rSet.Get( nWhich ) ));
pNameBox->SetText( pFontItem->GetFamilyName() );
pNameBox->set_active_text( pFontItem->GetFamilyName() );
}
else
{
pNameBox->SetText( OUString() );
pNameBox->set_active_text( OUString() );
}
FillStyleBox_Impl( pNameBox );
FillStyleBox_Impl(*pNameBox);
bool bStyle = false;
bool bStyleAvailable = true;
@@ -776,24 +779,24 @@
if ( bStyle && pFontItem )
{
FontMetric aFontMetric = pFontList->Get( pFontItem->GetFamilyName(), eWeight, eItalic );
pStyleBox->SetText( pFontList->GetStyleName( aFontMetric ) );
pStyleBox->set_active_text( pFontList->GetStyleName( aFontMetric ) );
}
else if ( !m_pImpl->m_bInSearchMode || !bStyle )
{
pStyleBox->SetText( OUString() );
pStyleBox->set_active_text( OUString() );
}
else if ( bStyle )
{
FontMetric aFontMetric = pFontList->Get( OUString(), eWeight, eItalic );
pStyleBox->SetText( pFontList->GetStyleName( aFontMetric ) );
pStyleBox->set_active_text( pFontList->GetStyleName( aFontMetric ) );
}
if (!bStyleAvailable)
{
pStyleBox->Disable( );
pStyleLabel->Disable( );
pStyleBox->set_sensitive(false);
pStyleLabel->set_sensitive(false);
}
FillSizeBox_Impl( pNameBox );
FillSizeBox_Impl(*pNameBox);
switch ( eLangGrp )
{
case Western : nWhich = GetWhich( SID_ATTR_CHAR_FONTHEIGHT ); break;
@@ -811,27 +814,27 @@
{
bool bPtRel = MapUnit::MapPoint == rItem.GetPropUnit();
pSizeBox->SetPtRelative( bPtRel );
pSizeBox->SetValue( bPtRel ? static_cast<short>(rItem.GetProp()) * 10 : rItem.GetProp() );
pSizeBox->set_value( bPtRel ? static_cast<short>(rItem.GetProp()) * 10 : rItem.GetProp() );
}
else
{
pSizeBox->SetRelative(false);
pSizeBox->SetValue( CalcToPoint( rItem.GetHeight(), eUnit, 10 ) );
pSizeBox->set_value( CalcToPoint( rItem.GetHeight(), eUnit, 10 ) );
}
}
else if ( eState >= SfxItemState::DEFAULT )
{
MapUnit eUnit = rSet.GetPool()->GetMetric( nWhich );
const SvxFontHeightItem& rItem = static_cast<const SvxFontHeightItem&>(rSet.Get( nWhich ));
pSizeBox->SetValue( CalcToPoint( rItem.GetHeight(), eUnit, 10 ) );
pSizeBox->set_value( CalcToPoint( rItem.GetHeight(), eUnit, 10 ) );
}
else
{
pSizeBox->SetText( OUString() );
pSizeBox->set_active_text( OUString() );
if ( eState <= SfxItemState::READONLY )
{
pSizeBox->Disable( );
pSizeLabel->Disable( );
pSizeBox->set_sensitive(false);
pSizeLabel->set_sensitive(false);
}
}
@@ -841,20 +844,20 @@
case Asian : nWhich = GetWhich( SID_ATTR_CHAR_CJK_LANGUAGE ); break;
case Ctl : nWhich = GetWhich( SID_ATTR_CHAR_CTL_LANGUAGE ); break;
}
pLangBox->SetNoSelectionLBB();
pLangBox->set_active(-1);
eState = rSet.GetItemState( nWhich );
switch ( eState )
{
case SfxItemState::UNKNOWN:
pLangFT->Hide();
pLangBox->HideLBB();
pLangFT->hide();
pLangBox->hide();
break;
case SfxItemState::DISABLED:
case SfxItemState::READONLY:
pLangFT->Disable();
pLangBox->DisableLBB();
pLangFT->set_sensitive(false);
pLangBox->set_sensitive(false);
break;
case SfxItemState::DEFAULT:
@@ -863,8 +866,8 @@
const SvxLanguageItem& rItem = static_cast<const SvxLanguageItem&>(rSet.Get( nWhich ));
LanguageType eLangType = rItem.GetValue();
DBG_ASSERT( eLangType != LANGUAGE_SYSTEM, "LANGUAGE_SYSTEM not allowed" );
if ( eLangType != LANGUAGE_DONTKNOW )
pLangBox->SelectLanguage( eLangType );
if (eLangType != LANGUAGE_DONTKNOW)
pLangBox->set_active_id(eLangType);
break;
}
case SfxItemState::DONTCARE:
@@ -872,62 +875,62 @@
}
OUString sMapText(pFontList->GetFontMapText(
pFontList->Get(pNameBox->GetText(), pStyleBox->GetText())));
pFontList->Get(pNameBox->get_active_text(), pStyleBox->get_active_text())));
switch (eLangGrp)
{
case Western:
m_pWestFontTypeFT->SetText(sMapText);
m_xWestFontTypeFT->set_label(sMapText);
break;
case Asian:
m_pEastFontTypeFT->SetText(sMapText);
m_xEastFontTypeFT->set_label(sMapText);
break;
case Ctl:
m_pCTLFontTypeFT->SetText(sMapText);
m_xCTLFontTypeFT->set_label(sMapText);
break;
}
// save these settings
pNameBox->SaveValue();
pStyleBox->SaveValue();
pSizeBox->SaveValue();
pLangBox->SaveValueLBB();
pNameBox->save_value();
pStyleBox->save_value();
pSizeBox->save_value();
pLangBox->save_active_id();
}
bool SvxCharNamePage::FillItemSet_Impl( SfxItemSet& rSet, LanguageGroup eLangGrp )
{
bool bModified = false;
FontNameBox* pNameBox = nullptr;
FontStyleBox* pStyleBox = nullptr;
FontSizeBox* pSizeBox = nullptr;
SvxLanguageBoxBase* pLangBox = nullptr;
weld::ComboBoxText* pNameBox = nullptr;
SvtFontStyleBox* pStyleBox = nullptr;
SvtFontSizeBox* pSizeBox = nullptr;
LanguageBox* pLangBox = nullptr;
sal_uInt16 nWhich = 0;
sal_uInt16 nSlot = 0;
switch ( eLangGrp )
{
case Western :
pNameBox = m_pWestFontNameLB;
pStyleBox = m_pWestFontStyleLB;
pSizeBox = m_pWestFontSizeLB;
pLangBox = m_pWestFontLanguageLB;
pNameBox = m_xWestFontNameLB.get();
pStyleBox = m_xWestFontStyleLB.get();
pSizeBox = m_xWestFontSizeLB.get();
pLangBox = m_xWestFontLanguageLB.get();
nSlot = SID_ATTR_CHAR_FONT;
break;
case Asian :
pNameBox = m_pEastFontNameLB;
pStyleBox = m_pEastFontStyleLB;
pSizeBox = m_pEastFontSizeLB;
pLangBox = m_pEastFontLanguageLB;
pNameBox = m_xEastFontNameLB.get();
pStyleBox = m_xEastFontStyleLB.get();
pSizeBox = m_xEastFontSizeLB.get();
pLangBox = m_xEastFontLanguageLB.get();
nSlot = SID_ATTR_CHAR_CJK_FONT;
break;
case Ctl :
pNameBox = m_pCTLFontNameLB;
pStyleBox = m_pCTLFontStyleLB;
pSizeBox = m_pCTLFontSizeLB;
pLangBox = m_pCTLFontLanguageLB;
pNameBox = m_xCTLFontNameLB.get();
pStyleBox = m_xCTLFontStyleLB.get();
pSizeBox = m_xCTLFontSizeLB.get();
pLangBox = m_xCTLFontLanguageLB.get();
nSlot = SID_ATTR_CHAR_CTL_FONT;
break;
}
@@ -940,11 +943,11 @@
const SfxItemSet* pExampleSet = GetDialogExampleSet();
bool bChanged = true;
const OUString& rFontName = pNameBox->GetText();
const OUString& rFontName = pNameBox->get_active_text();
const FontList* pFontList = GetFontList();
OUString aStyleBoxText =pStyleBox->GetText();
sal_Int32 nEntryPos = pStyleBox->GetEntryPos( aStyleBoxText );
if ( nEntryPos >= m_pImpl->m_nExtraEntryPos )
OUString aStyleBoxText = pStyleBox->get_active_text();
int nEntryPos = pStyleBox->find_text(aStyleBoxText);
if (nEntryPos >= m_pImpl->m_nExtraEntryPos)
aStyleBoxText.clear();
FontMetric aInfo( pFontList->Get( rFontName, aStyleBoxText ) );
SvxFontItem aFontItem( aInfo.GetFamilyType(), aInfo.GetFamilyName(), aInfo.GetStyleName(),
@@ -960,7 +963,7 @@
}
if ( !bChanged )
bChanged = pNameBox->GetSavedValue().isEmpty();
bChanged = pNameBox->get_saved_value().isEmpty();
if ( !bChanged && pExampleSet &&
pExampleSet->GetItemState( nWhich, false, &pItem ) == SfxItemState::SET &&
@@ -1000,7 +1003,7 @@
if ( !bChanged )
{
bChanged = pStyleBox->GetSavedValue().isEmpty();
bChanged = pStyleBox->get_saved_value().isEmpty();
if ( m_pImpl->m_bInSearchMode && bChanged &&
aInfo.GetWeight() == WEIGHT_NORMAL && aInfo.GetItalic() != ITALIC_NONE )
@@ -1015,7 +1018,7 @@
if ( nEntryPos >= m_pImpl->m_nExtraEntryPos )
bChanged = ( nEntryPos == m_pImpl->m_nExtraEntryPos );
OUString aText( pStyleBox->GetText() ); // Tristate, then text empty
OUString aText( pStyleBox->get_active_text() ); // Tristate, then text empty
if ( bChanged && !aText.isEmpty() )
{
@@ -1049,7 +1052,7 @@
if ( !bChanged )
{
bChanged = pStyleBox->GetSavedValue().isEmpty();
bChanged = pStyleBox->get_saved_value().isEmpty();
if ( m_pImpl->m_bInSearchMode && bChanged &&
aInfo.GetItalic() == ITALIC_NONE && aInfo.GetWeight() != WEIGHT_NORMAL )
@@ -1073,11 +1076,11 @@
rSet.InvalidateItem(nWhich);
// FontSize
long nSize = static_cast<long>(pSizeBox->GetValue());
long nSize = pSizeBox->get_value();
if ( pSizeBox->GetText().isEmpty() ) // GetValue() returns the min-value
if ( pSizeBox->get_active_text().isEmpty() ) // GetValue() returns the min-value
nSize = 0;
long nSavedSize = static_cast<long>(pSizeBox->GetSavedIntValue());
long nSavedSize = pSizeBox->get_saved_value();
const bool bRel = pSizeBox->IsRelative();
switch ( eLangGrp )
@@ -1138,44 +1141,42 @@
// For language list boxes acting as ComboBox, check for, add and select an
// edited entry.
SvxLanguageComboBox* pLangComboBox = dynamic_cast<SvxLanguageComboBox*>(pLangBox);
if (pLangComboBox)
if (pLangBox == m_xWestFontLanguageLB.get())
{
switch (pLangComboBox->GetEditedAndValid())
switch (pLangBox->GetEditedAndValid())
{
case SvxLanguageComboBox::EditedAndValid::No:
case LanguageBox::EditedAndValid::No:
; // nothing to do
break;
case SvxLanguageComboBox::EditedAndValid::Valid:
case LanguageBox::EditedAndValid::Valid:
{
const sal_Int32 nPos = pLangComboBox->SaveEditedAsEntry();
if (nPos != COMBOBOX_ENTRY_NOTFOUND)
pLangComboBox->SelectEntryPos( nPos);
const int nPos = pLangBox->SaveEditedAsEntry();
if (nPos != -1)
pLangBox->set_active(nPos);
}
break;
case SvxLanguageComboBox::EditedAndValid::Invalid:
pLangComboBox->SelectEntryPos( pLangComboBox->GetSavedValueLBB());
case LanguageBox::EditedAndValid::Invalid:
pLangBox->set_active_id(pLangBox->get_saved_active_id());
break;
}
}
sal_Int32 nLangPos = pLangBox->GetSelectedEntryPosLBB();
LanguageType eLangType = LanguageType(reinterpret_cast<sal_uLong>(pLangBox->GetEntryDataLBB( nLangPos )));
int nLangPos = pLangBox->get_active();
LanguageType eLangType = pLangBox->get_active_id();
if ( pOld )
if (pOld)
{
const SvxLanguageItem& rItem = *static_cast<const SvxLanguageItem*>(pOld);
if ( nLangPos == LISTBOX_ENTRY_NOTFOUND || eLangType == rItem.GetValue() )
if (nLangPos == -1 || eLangType == rItem.GetValue())
bChanged = false;
}
if ( !bChanged )
bChanged = ( pLangBox->GetSavedValueLBB() == LISTBOX_ENTRY_NOTFOUND );
if (!bChanged)
bChanged = pLangBox->get_active_id_changed_from_saved();
if ( bChanged && nLangPos != LISTBOX_ENTRY_NOTFOUND )
if (bChanged && nLangPos != -1)
{
rSet.Put( SvxLanguageItem( eLangType, nWhich ) );
rSet.Put(SvxLanguageItem(eLangType, nWhich));
bModified = true;
}
else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
@@ -1184,43 +1185,39 @@
return bModified;
}
IMPL_LINK_NOARG(SvxCharNamePage, UpdateHdl_Impl, Timer *, void)
{
UpdatePreview_Impl();
}
IMPL_LINK(SvxCharNamePage, FontModifyComboBoxHdl_Impl, weld::ComboBoxText&, rBox, void)
{
FontModifyHdl_Impl(rBox);
}
IMPL_LINK( SvxCharNamePage, FontModifyComboBoxHdl_Impl, ComboBox&, rBox, void )
IMPL_LINK(SvxCharNamePage, FontModifyEditHdl_Impl, weld::Entry&, rBox, void)
{
FontModifyHdl_Impl(&rBox);
FontModifyHdl_Impl(rBox);
}
IMPL_LINK( SvxCharNamePage, FontModifyListBoxHdl_Impl, ListBox&, rBox, void )
{
FontModifyHdl_Impl(&rBox);
}
IMPL_LINK( SvxCharNamePage, FontModifyEditHdl_Impl, Edit&, rBox, void )
{
FontModifyHdl_Impl(&rBox);
}
IMPL_LINK(SvxCharNamePage, FontFeatureButtonClicked, Button*, pButton, void )
IMPL_LINK(SvxCharNamePage, FontFeatureButtonClicked, weld::Button&, rButton, void)
{
OUString sFontName;
FontNameBox * pNameBox = nullptr;
weld::ComboBoxText* pNameBox = nullptr;
if (pButton == m_pWestFontFeaturesButton.get())
if (&rButton == m_xWestFontFeaturesButton.get())
{
pNameBox = m_pWestFontNameLB;
pNameBox = m_xWestFontNameLB.get();
sFontName = GetPreviewFont().GetFamilyName();
}
else if (pButton == m_pEastFontFeaturesButton.get())
else if (&rButton == m_xEastFontFeaturesButton.get())
{
pNameBox = m_pEastFontNameLB;
pNameBox = m_xEastFontNameLB.get();
sFontName = GetPreviewCJKFont().GetFamilyName();
}
else if (pButton == m_pCTLFontFeaturesButton.get())
else if (&rButton == m_xCTLFontFeaturesButton.get())
{
pNameBox = m_pCTLFontNameLB;
pNameBox = m_xCTLFontNameLB.get();
sFontName = GetPreviewCTLFont().GetFamilyName();
}
@@ -1229,32 +1226,30 @@
cui::FontFeaturesDialog aDialog(GetDialogFrameWeld(), sFontName);
if (aDialog.execute() == RET_OK)
{
pNameBox->SetText(aDialog.getResultFontName());
pNameBox->set_active_text(aDialog.getResultFontName());
UpdatePreview_Impl();
}
}
}
void SvxCharNamePage::FontModifyHdl_Impl(void const * pNameBox)
void SvxCharNamePage::FontModifyHdl_Impl(const weld::Widget& rNameBox)
{
m_pImpl->m_aUpdateIdle.Start();
if ( m_pWestFontNameLB == pNameBox || m_pEastFontNameLB == pNameBox || m_pCTLFontNameLB == pNameBox )
if (m_xWestFontNameLB.get() == &rNameBox || m_xEastFontNameLB.get() == &rNameBox || m_xCTLFontNameLB.get() == &rNameBox)
{
FillStyleBox_Impl( static_cast<FontNameBox const *>(pNameBox) );
FillSizeBox_Impl( static_cast<FontNameBox const *>(pNameBox) );
FillStyleBox_Impl(rNameBox);
FillSizeBox_Impl(rNameBox);
}
}
void SvxCharNamePage::ActivatePage( const SfxItemSet& rSet )
{
SvxCharBasePage::ActivatePage( rSet );
CharBasePage::ActivatePage( rSet );
UpdatePreview_Impl(); // instead of asynchronous calling in ctor
}
DeactivateRC SvxCharNamePage::DeactivatePage( SfxItemSet* _pSet )
{
if ( _pSet )
@@ -1262,13 +1257,11 @@
return DeactivateRC::LeavePage;
}
VclPtr<SfxTabPage> SvxCharNamePage::Create( TabPageParent pParent, const SfxItemSet* rSet )
VclPtr<SfxTabPage> SvxCharNamePage::Create(TabPageParent pParent, const SfxItemSet* rSet)
{
return VclPtr<SvxCharNamePage>::Create( pParent.pParent, *rSet );
return VclPtr<SvxCharNamePage>::Create(pParent, *rSet );
}
void SvxCharNamePage::Reset( const SfxItemSet* rSet )
{
Reset_Impl( *rSet, Western );
@@ -1278,20 +1271,21 @@
SetPrevFontWidthScale( *rSet );
UpdatePreview_Impl();
}
void SvxCharNamePage::ChangesApplied()
{
m_pWestFontNameLB->SaveValue();
m_pWestFontStyleLB->SaveValue();
m_pWestFontSizeLB->SaveValue();
m_pWestFontLanguageLB->SaveValueLBB();
m_pEastFontNameLB->SaveValue();
m_pEastFontStyleLB->SaveValue();
m_pEastFontSizeLB->SaveValue();
m_pEastFontLanguageLB->SaveValueLBB();
m_pCTLFontNameLB->SaveValue();
m_pCTLFontStyleLB->SaveValue();
m_pCTLFontSizeLB->SaveValue();
m_pCTLFontLanguageLB->SaveValueLBB();
m_xWestFontNameLB->save_value();
m_xWestFontStyleLB->save_value();
m_xWestFontSizeLB->save_value();
m_xWestFontLanguageLB->save_active_id();
m_xEastFontNameLB->save_value();
m_xEastFontStyleLB->save_value();
m_xEastFontSizeLB->save_value();
m_xEastFontLanguageLB->save_active_id();
m_xCTLFontNameLB->save_value();
m_xCTLFontStyleLB->save_value();
m_xCTLFontSizeLB->save_value();
m_xCTLFontLanguageLB->save_active_id();
}
bool SvxCharNamePage::FillItemSet( SfxItemSet* rSet )
@@ -1302,16 +1296,14 @@
return bModified;
}
void SvxCharNamePage::SetFontList( const SvxFontListItem& rItem )
{
m_pImpl->m_pFontList = rItem.GetFontList()->Clone();
}
namespace
{
void enableRelativeMode( SvxCharNamePage const * _pPage, FontSizeBox* _pFontSizeLB, sal_uInt16 _nHeightWhich )
void enableRelativeMode( SvxCharNamePage const * _pPage, SvtFontSizeBox* _pFontSizeLB, sal_uInt16 _nHeightWhich )
{
_pFontSizeLB->EnableRelativeMode( 5, 995 ); // min 5%, max 995%, step 5
@@ -1328,16 +1320,14 @@
}
}
void SvxCharNamePage::EnableRelativeMode()
{
DBG_ASSERT( GetItemSet().GetParent(), "RelativeMode, but no ParentSet!" );
enableRelativeMode(this,m_pWestFontSizeLB,GetWhich( SID_ATTR_CHAR_FONTHEIGHT ));
enableRelativeMode(this,m_pEastFontSizeLB,GetWhich( SID_ATTR_CHAR_CJK_FONTHEIGHT ));
enableRelativeMode(this,m_pCTLFontSizeLB,GetWhich( SID_ATTR_CHAR_CTL_FONTHEIGHT ));
enableRelativeMode(this,m_xWestFontSizeLB.get(),GetWhich( SID_ATTR_CHAR_FONTHEIGHT ));
enableRelativeMode(this,m_xEastFontSizeLB.get(),GetWhich( SID_ATTR_CHAR_CJK_FONTHEIGHT ));
enableRelativeMode(this,m_xCTLFontSizeLB.get(),GetWhich( SID_ATTR_CHAR_CTL_FONTHEIGHT ));
}
void SvxCharNamePage::EnableSearchMode()
{
m_pImpl->m_bInSearchMode = true;
@@ -1347,26 +1337,25 @@
{
if ( DISABLE_LANGUAGE & nDisable )
{
if ( m_pWestFontLanguageFT ) m_pWestFontLanguageFT->Disable();
if ( m_pWestFontLanguageLB ) m_pWestFontLanguageLB->Disable();
if ( m_pEastFontLanguageFT ) m_pEastFontLanguageFT->Disable();
if ( m_pEastFontLanguageLB ) m_pEastFontLanguageLB->Disable();
if ( m_pCTLFontLanguageFT ) m_pCTLFontLanguageFT->Disable();
if ( m_pCTLFontLanguageLB ) m_pCTLFontLanguageLB->Disable();
if ( m_xWestFontLanguageFT ) m_xWestFontLanguageFT->set_sensitive(false);
if ( m_xWestFontLanguageLB ) m_xWestFontLanguageLB->set_sensitive(false);
if ( m_xEastFontLanguageFT ) m_xEastFontLanguageFT->set_sensitive(false);
if ( m_xEastFontLanguageLB ) m_xEastFontLanguageLB->set_sensitive(false);
if ( m_xCTLFontLanguageFT ) m_xCTLFontLanguageFT->set_sensitive(false);
if ( m_xCTLFontLanguageLB ) m_xCTLFontLanguageLB->set_sensitive(false);
}
if ( DISABLE_HIDE_LANGUAGE & nDisable )
{
if ( m_pWestFontLanguageFT ) m_pWestFontLanguageFT->Hide();
if ( m_pWestFontLanguageLB ) m_pWestFontLanguageLB->Hide();
if ( m_pEastFontLanguageFT ) m_pEastFontLanguageFT->Hide();
if ( m_pEastFontLanguageLB ) m_pEastFontLanguageLB->Hide();
if ( m_pCTLFontLanguageFT ) m_pCTLFontLanguageFT->Hide();
if ( m_pCTLFontLanguageLB ) m_pCTLFontLanguageLB->Hide();
if ( m_xWestFontLanguageFT ) m_xWestFontLanguageFT->hide();
if ( m_xWestFontLanguageLB ) m_xWestFontLanguageLB->hide();
if ( m_xEastFontLanguageFT ) m_xEastFontLanguageFT->hide();
if ( m_xEastFontLanguageLB ) m_xEastFontLanguageLB->hide();
if ( m_xCTLFontLanguageFT ) m_xCTLFontLanguageFT->hide();
if ( m_xCTLFontLanguageLB ) m_xCTLFontLanguageLB->hide();
}
}
void SvxCharNamePage::PageCreated(const SfxAllItemSet& aSet)
{
const SvxFontListItem* pFontListItem = aSet.GetItem<SvxFontListItem>(SID_ATTR_CHAR_FONTLIST, false);
diff --git a/cui/uiconfig/ui/charnamepage.ui b/cui/uiconfig/ui/charnamepage.ui
index 47be2ee..8412e41 100644
--- a/cui/uiconfig/ui/charnamepage.ui
+++ b/cui/uiconfig/ui/charnamepage.ui
@@ -2,7 +2,54 @@
<!-- Generated with glade 3.22.1 -->
<interface domain="cui">
<requires lib="gtk+" version="3.18"/>
<requires lib="LibreOffice" version="1.0"/>
<object class="GtkListStore" id="liststore1">
<columns>
<!-- column-name text -->
<column type="gchararray"/>
<!-- column-name id -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkEntryCompletion" id="entrycompletion1">
<property name="model">liststore1</property>
<property name="text_column">0</property>
<property name="inline_completion">True</property>
<property name="popup_completion">False</property>
<property name="popup_set_width">False</property>
<property name="popup_single_match">False</property>
</object>
<object class="GtkListStore" id="liststore2">
<columns>
<!-- column-name text -->
<column type="gchararray"/>
<!-- column-name id -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkEntryCompletion" id="entrycompletion2">
<property name="model">liststore2</property>
<property name="text_column">0</property>
<property name="inline_completion">True</property>
<property name="popup_completion">False</property>
<property name="popup_set_width">False</property>
<property name="popup_single_match">False</property>
</object>
<object class="GtkListStore" id="liststore3">
<columns>
<!-- column-name text -->
<column type="gchararray"/>
<!-- column-name id -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkEntryCompletion" id="entrycompletion3">
<property name="model">liststore3</property>
<property name="text_column">0</property>
<property name="inline_completion">True</property>
<property name="popup_completion">False</property>
<property name="popup_set_width">False</property>
<property name="popup_single_match">False</property>
</object>
<object class="GtkBox" id="CharNamePage">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -46,12 +93,64 @@
<property name="vexpand">True</property>
<property name="top_padding">6</property>
<child>
<object class="svtlo-FontNameBox" id="westfontnamelb-nocjk">
<object class="GtkGrid" id="namegrid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="dropdown">False</property>
<property name="row_spacing">3</property>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="westfontnamelb-nocjk">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="model">liststore1</property>
<property name="headers_visible">False</property>
<property name="headers_clickable">False</property>
<property name="search_column">0</property>
<property name="show_expanders">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn1">
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="westfontname-nocjk">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="activates_default">True</property>
<property name="completion">entrycompletion1</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
</child>
</object>
@@ -73,7 +172,6 @@
<object class="GtkFrame" id="frame2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
@@ -81,16 +179,63 @@
<object class="GtkAlignment" id="alignment7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="top_padding">6</property>
<child>
<object class="svtlo-FontStyleBox" id="weststylelb-nocjk">
<object class="GtkGrid" id="stylegrid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="can_focus">False</property>
<property name="vexpand">True</property>
<property name="dropdown">False</property>
<property name="row_spacing">3</property>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="weststylelb-nocjk">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="vexpand">True</property>
<property name="model">liststore2</property>
<property name="headers_visible">False</property>
<property name="headers_clickable">False</property>
<property name="search_column">0</property>
<property name="show_expanders">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection2"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn2">
<child>
<object class="GtkCellRendererText" id="cellrenderertext2"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="weststyle-nocjk">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="activates_default">True</property>
<property name="completion">entrycompletion2</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
</child>
</object>
@@ -112,7 +257,6 @@
<object class="GtkFrame" id="frame3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
@@ -120,17 +264,64 @@
<object class="GtkAlignment" id="alignment8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="top_padding">6</property>
<child>
<object class="svtlo-FontSizeBox" id="westsizelb-nocjk">
<property name="height_request">150</property>
<object class="GtkGrid" id="sizegrid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="can_focus">False</property>
<property name="vexpand">True</property>
<property name="dropdown">False</property>
<property name="row_spacing">3</property>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="vexpand">True</property>
<property name="vscrollbar_policy">always</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="westsizelb-nocjk">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="vexpand">True</property>
<property name="model">liststore3</property>
<property name="headers_visible">False</property>
<property name="headers_clickable">False</property>
<property name="search_column">0</property>
<property name="show_expanders">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection3"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn3">
<child>
<object class="GtkCellRendererText" id="cellrenderertext3"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="westsize-nocjk">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="activates_default">True</property>
<property name="completion">entrycompletion3</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
</child>
</object>
@@ -177,11 +368,17 @@
</packing>
</child>
<child>
<object class="svxcorelo-SvxLanguageComboBox" id="westlanglb-nocjk">
<object class="GtkComboBoxText" id="westlanglb-nocjk">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry">
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
@@ -249,7 +446,6 @@
<object class="GtkLabel" id="westfontnameft-cjk">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" context="charnamepage|westfontnameft-cjk">Family:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">westfontnamelb-cjk</property>
@@ -264,7 +460,6 @@
<object class="GtkLabel" id="weststyleft-cjk">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" context="charnamepage|weststyleft-cjk">Style:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">weststylelb-cjk</property>
@@ -279,7 +474,6 @@
<object class="GtkLabel" id="westsizeft-cjk">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes" context="charnamepage|westsizeft-cjk">Size:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">westsizelb-cjk</property>
@@ -294,7 +488,6 @@
<object class="GtkLabel" id="westlangft-cjk">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes" context="charnamepage|westlangft-cjk">Language:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">westlanglb-cjk</property>
@@ -306,10 +499,16 @@
</packing>
</child>
<child>
<object class="svtlo-FontNameBox" id="westfontnamelb-cjk">
<object class="GtkComboBoxText" id="westfontnamelb-cjk">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry">
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
@@ -317,10 +516,15 @@
</packing>
</child>
<child>
<object class="svtlo-FontStyleBox" id="weststylelb-cjk">
<object class="GtkComboBoxText" id="weststylelb-cjk">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry">
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
@@ -328,10 +532,15 @@
</packing>
</child>
<child>
<object class="svtlo-FontSizeBox" id="westsizelb-cjk">
<object class="GtkComboBoxText" id="westsizelb-cjk">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry">
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">2</property>
@@ -339,10 +548,15 @@
</packing>
</child>
<child>
<object class="svxcorelo-SvxLanguageComboBox" id="westlanglb-cjk">
<object class="GtkComboBoxText" id="westlanglb-cjk">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry">
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">3</property>
@@ -350,33 +564,42 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="westfontinfo-cjk">
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">6</property>
<property name="xalign">0</property>
<child>
<object class="GtkLabel" id="westfontinfo-cjk">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">6</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="west_features_button-cjk">
<property name="label" translatable="yes" context="charnamepage|west_features_button-cjk">Features...</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">5</property>
<property name="width">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="west_features_button-cjk">
<property name="label" translatable="yes" context="charnamepage|west_features_button-cjk">Features...</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">4</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
@@ -422,7 +645,6 @@
<object class="GtkLabel" id="eastfontnameft">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" context="charnamepage|eastfontnameft">Family:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">eastfontnamelb</property>
@@ -437,7 +659,6 @@
<object class="GtkLabel" id="eaststyleft">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" context="charnamepage|eaststyleft">Style:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">eaststylelb</property>
@@ -452,7 +673,6 @@
<object class="GtkLabel" id="eastsizeft">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes" context="charnamepage|eastsizeft">Size:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">eastsizelb</property>
@@ -467,7 +687,6 @@
<object class="GtkLabel" id="eastlangft">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes" context="charnamepage|eastlangft">Language:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">eastlanglb</property>
@@ -479,10 +698,16 @@
</packing>
</child>
<child>
<object class="svtlo-FontNameBox" id="eastfontnamelb">
<object class="GtkComboBoxText" id="eastfontnamelb">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry">
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
@@ -490,10 +715,15 @@
</packing>
</child>
<child>
<object class="svtlo-FontStyleBox" id="eaststylelb">
<object class="GtkComboBoxText" id="eaststylelb">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry">
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
@@ -501,10 +731,15 @@
</packing>
</child>
<child>
<object class="svtlo-FontSizeBox" id="eastsizelb">
<object class="GtkComboBoxText" id="eastsizelb">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry">
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">2</property>
@@ -512,10 +747,9 @@
</packing>
</child>
<child>
<object class="svxcorelo-SvxLanguageBox" id="eastlanglb">
<object class="GtkComboBoxText" id="eastlanglb">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">3</property>
@@ -523,32 +757,41 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="eastfontinfo">
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<child>
<object class="GtkLabel" id="eastfontinfo">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="east_features_button">
<property name="label" translatable="yes" context="charnamepage|east_features_button">Features...</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">5</property>
<property name="width">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="east_features_button">
<property name="label" translatable="yes" context="charnamepage|east_features_button">Features...</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">4</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
@@ -594,7 +837,6 @@
<object class="GtkLabel" id="ctlfontnameft">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" context="charnamepage|ctlfontnameft">Family:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">ctlfontnamelb</property>
@@ -609,7 +851,6 @@
<object class="GtkLabel" id="ctlstyleft">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" context="charnamepage|ctlstyleft">Style:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">ctlstylelb</property>
@@ -624,7 +865,6 @@
<object class="GtkLabel" id="ctlsizeft">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes" context="charnamepage|ctlsizeft">Size:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">ctlsizelb</property>
@@ -639,7 +879,6 @@
<object class="GtkLabel" id="ctllangft">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes" context="charnamepage|ctllangft">Language:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">ctllanglb</property>
@@ -651,10 +890,16 @@
</packing>
</child>
<child>
<object class="svtlo-FontNameBox" id="ctlfontnamelb">
<object class="GtkComboBoxText" id="ctlfontnamelb">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry">
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
@@ -662,10 +907,15 @@
</packing>
</child>
<child>
<object class="svtlo-FontStyleBox" id="ctlstylelb">
<object class="GtkComboBoxText" id="ctlstylelb">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry">
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
@@ -673,10 +923,15 @@
</packing>
</child>
<child>
<object class="svtlo-FontSizeBox" id="ctlsizelb">
<object class="GtkComboBoxText" id="ctlsizelb">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry">
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">2</property>
@@ -684,10 +939,9 @@
</packing>
</child>
<child>
<object class="svxcorelo-SvxLanguageBox" id="ctllanglb">
<object class="GtkComboBoxText" id="ctllanglb">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">3</property>
@@ -695,33 +949,42 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="ctlfontinfo">
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">6</property>
<property name="xalign">0</property>
<child>
<object class="GtkLabel" id="ctlfontinfo">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">6</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ctl_features_button">
<property name="label" translatable="yes" context="charnamepage|ctl_features_button">Features...</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">5</property>
<property name="width">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ctl_features_button">
<property name="label" translatable="yes" context="charnamepage|ctl_features_button">Features...</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">4</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
@@ -752,12 +1015,27 @@
<property name="left_padding">12</property>
<property name="right_padding">12</property>
<child>
<object class="svxlo-SvxFontPrevWindow" id="preview:border">
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child internal-child="accessible">
<object class="AtkObject" id="preview:border-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="charnamepage|preview-atkobject">Preview</property>
<property name="hscrollbar_policy">never</property>
<property name="vscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkDrawingArea" id="preview">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child internal-child="accessible">
<object class="AtkObject" id="preview-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="charnamepage|preview-atkobject">Preview</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index ac80781..e79db66 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -496,10 +496,6 @@
generic-name="LanguageBox" parent="VclComboBoxText"
icon-name="widget-gtk-combobox"/>
<glade-widget-class title="Language ComboBox" name="svxcorelo-SvxLanguageComboBox"
generic-name="LanguageComboBox" parent="VclComboBoxText"
icon-name="widget-gtk-comboboxtext"/>
<glade-widget-class title="Reference Button" name="foruilo-RefButton"
generic-name="Reference Button" parent="GtkButton"
icon-name="widget-gtk-button"/>
diff --git a/include/sfx2/newstyle.hxx b/include/sfx2/newstyle.hxx
index 6fecb33..5cd9e24 100644
--- a/include/sfx2/newstyle.hxx
+++ b/include/sfx2/newstyle.hxx
@@ -38,13 +38,13 @@
DECL_DLLPRIVATE_LINK(OKHdl, weld::TreeView&, void);
DECL_DLLPRIVATE_LINK(OKClickHdl, weld::Button&, void);
DECL_DLLPRIVATE_LINK(ModifyHdl, weld::Entry&, void);
DECL_DLLPRIVATE_LINK(ModifyHdl, weld::ComboBoxText&, void);
public:
SfxNewStyleDlg(weld::Window* pParent, SfxStyleSheetBasePool&);
virtual ~SfxNewStyleDlg() override;
OUString GetName() const { return comphelper::string::stripStart(m_xColBox->get_text(), ' '); }
OUString GetName() const { return comphelper::string::stripStart(m_xColBox->get_active_text(), ' '); }
};
#endif
diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx
index 65c2f5d..5ff94f0 100644
--- a/include/svtools/ctrlbox.hxx
+++ b/include/svtools/ctrlbox.hxx
@@ -409,7 +409,12 @@
virtual void Modify() override;
virtual Size GetOptimalSize() const override;
void SetText( const OUString& rText ) override;
void SetText( const OUString& rText ) override
{
aLastStyle = rText;
ComboBox::SetText( rText );
}
void Fill( const OUString& rName, const FontList* pList );
private:
@@ -417,11 +422,27 @@
FontStyleBox& operator =( const FontStyleBox& ) = delete;
};
inline void FontStyleBox::SetText( const OUString& rText )
class SVT_DLLPUBLIC SvtFontStyleBox
{
aLastStyle = rText;
ComboBox::SetText( rText );
}
std::unique_ptr<weld::ComboBoxText> m_xComboBox;
public:
SvtFontStyleBox(std::unique_ptr<weld::ComboBoxText> p);
void Fill(const OUString& rName, const FontList* pList);
void connect_changed(const Link<weld::ComboBoxText&, void>& rLink) { m_xComboBox->connect_changed(rLink); }
OUString get_active_text() const { return m_xComboBox->get_active_text(); }
void set_active_text(const OUString& rText) { m_xComboBox->set_active_text(rText); }
void append_text(const OUString& rStr) { m_xComboBox->append_text(rStr); }
void set_sensitive(bool bSensitive) { m_xComboBox->set_sensitive(bSensitive); }
void save_value() { m_xComboBox->save_value(); }
OUString const& get_saved_value() const { return m_xComboBox->get_saved_value(); }
int get_count() const { return m_xComboBox->get_count(); }
int find_text(const OUString& rStr) const { return m_xComboBox->find_text(rStr); }
private:
SvtFontStyleBox(const SvtFontStyleBox& ) = delete;
SvtFontStyleBox& operator=(const SvtFontStyleBox&) = delete;
};
class SVT_DLLPUBLIC FontSizeBox : public MetricBox
{
@@ -472,6 +493,73 @@
FontSizeBox& operator =( const FontSizeBox& ) = delete;
};
class SVT_DLLPUBLIC SvtFontSizeBox
{
FontMetric aFontMetric;
const FontList* pFontList;
int nSavedValue;
int nMin;
int nMax;
FieldUnit eUnit;
sal_uInt16 nDecimalDigits;
sal_uInt16 nRelMin;
sal_uInt16 nRelMax;
sal_uInt16 nRelStep;
short nPtRelMin;
short nPtRelMax;
short nPtRelStep;
bool bRelativeMode:1,
bRelative:1,
bPtRelative:1,
bStdSize:1;
Link<weld::ComboBoxText&, void> m_aChangeHdl;
std::unique_ptr<weld::ComboBoxText> m_xComboBox;
sal_uInt16 GetDecimalDigits() const { return nDecimalDigits; }
void SetDecimalDigits(sal_uInt16 nDigits) { nDecimalDigits = nDigits; }
FieldUnit GetUnit() const { return eUnit; }
void SetUnit(FieldUnit _eUnit) { eUnit = _eUnit; }
void SetRange(int nNewMin, int nNewMax) { nMin = nNewMin; nMax = nNewMax; }
void SetValue(int nNewValue, FieldUnit eInUnit);
void InsertValue(int i);
OUString format_number(int nValue) const;
DECL_LINK(ModifyHdl, weld::ComboBoxText&, void);
DECL_LINK(ReformatHdl, weld::Widget&, void);
public:
SvtFontSizeBox(std::unique_ptr<weld::ComboBoxText> p);
void Fill(const FontMetric* pFontMetric, const FontList* pList);
void EnableRelativeMode(sal_uInt16 nMin, sal_uInt16 nMax, sal_uInt16 nStep = 5);
void EnablePtRelativeMode(short nMin, short nMax, short nStep = 10);
bool IsRelativeMode() const { return bRelativeMode; }
void SetRelative( bool bRelative );
bool IsRelative() const { return bRelative; }
void SetPtRelative( bool bPtRel )
{
bPtRelative = bPtRel;
SetRelative(true);
}
bool IsPtRelative() const { return bPtRelative; }
void connect_changed(const Link<weld::ComboBoxText&, void>& rLink) { m_aChangeHdl = rLink; }
OUString get_active_text() const { return m_xComboBox->get_active_text(); }
void set_active_text(const OUString& rText) { m_xComboBox->set_active_text(rText); }
void set_sensitive(bool bSensitive) { m_xComboBox->set_sensitive(bSensitive); }
int get_value() const;
void set_value(int nValue);
void save_value() { nSavedValue = get_value(); }
int get_saved_value() const { return nSavedValue; }
private:
SvtFontSizeBox(const SvtFontSizeBox&) = delete;
SvtFontSizeBox& operator=(const SvtFontSizeBox&) = delete;
};
#endif // INCLUDED_SVTOOLS_CTRLBOX_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/langbox.hxx b/include/svx/langbox.hxx
index 9b13055..723957c 100644
--- a/include/svx/langbox.hxx
+++ b/include/svx/langbox.hxx
@@ -149,12 +149,23 @@
class SVX_DLLPUBLIC LanguageBox
{
public:
enum class EditedAndValid
{
No,
Valid,
Invalid
};
private:
std::unique_ptr<weld::ComboBoxText> m_xControl;
Link<weld::ComboBoxText&, void> m_aChangeHdl;
OUString m_aAllString;
LanguageType m_eSavedLanguage;
EditedAndValid m_eEditedAndValid;
bool m_bHasLangNone;
bool m_bLangNoneIsLangAll;
bool m_bWithCheckmark;
SVX_DLLPRIVATE int ImplTypeToPos(LanguageType eType) const;
SVX_DLLPRIVATE void ImplClear();
@@ -162,17 +173,24 @@
public:
LanguageBox(std::unique_ptr<weld::ComboBoxText> pControl);
void SetLanguageList( SvxLanguageListFlags nLangList,
bool bHasLangNone, bool bLangNoneIsLangAll = false );
bool bHasLangNone, bool bLangNoneIsLangAll = false,
bool bCheckSpellAvail = false );
void AddLanguages( const std::vector< LanguageType >& rLanguageTypes, SvxLanguageListFlags nLangList );
void InsertLanguage(const LanguageType nLangType);
void SelectLanguage( const LanguageType eLangType );
LanguageType GetSelectedLanguage() const;
void SelectEntryPos(int nPos) { m_xControl->set_active(nPos); }
EditedAndValid GetEditedAndValid() const { return m_eEditedAndValid;}
sal_Int32 SaveEditedAsEntry();
void connect_changed(const Link<weld::ComboBoxText&, void>& rLink) { m_aChangeHdl = rLink; }
void save_value() { m_xControl->save_value(); }
bool get_value_changed_from_saved() const { return m_xControl->get_value_changed_from_saved(); }
void save_active_id() { m_eSavedLanguage = get_active_id(); }
LanguageType get_saved_active_id() const { return m_eSavedLanguage; }
bool get_active_id_changed_from_saved() const { return m_eSavedLanguage != get_active_id(); }
void hide() { m_xControl->hide(); }
void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); }
void set_active(int nPos) { m_xControl->set_active(nPos); }
int get_active() const { return m_xControl->get_active(); }
void set_active_id(const LanguageType eLangType);
LanguageType get_active_id() const;
};
class SVX_DLLPUBLIC SvxLanguageComboBox : public ComboBox, public SvxLanguageBoxBase
diff --git a/include/vcl/combobox.hxx b/include/vcl/combobox.hxx
index 4d30398..890d5c1 100644
--- a/include/vcl/combobox.hxx
+++ b/include/vcl/combobox.hxx
@@ -173,6 +173,8 @@
void setMaxWidthChars(sal_Int32 nWidth);
void SetWidthInChars(sal_Int32 nWidthInChars);
virtual bool set_property(const OString &rKey, const OUString &rValue) override;
virtual FactoryFunction GetUITestFactory() const override;
diff --git a/include/vcl/lstbox.hxx b/include/vcl/lstbox.hxx
index 62ad362..fbc6bbc 100644
--- a/include/vcl/lstbox.hxx
+++ b/include/vcl/lstbox.hxx
@@ -70,10 +70,12 @@
class ImplBtn;
class ImplWin;
class ImplListBoxWindow;
class SalInstanceEntryTreeView;
class VCL_DLLPUBLIC ListBox : public Control
{
private:
friend SalInstanceEntryTreeView;
VclPtr<ImplListBox> mpImplLB;
VclPtr<ImplListBoxFloatingWindow> mpFloatWin;
VclPtr<ImplWin> mpImplWin;
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 5c82b6d..b74df52 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -255,33 +255,41 @@
void signal_changed() { m_aChangeHdl.Call(*this); }
public:
virtual int get_active() const = 0;
virtual void set_active(int pos) = 0;
virtual OUString get_active_text() const = 0;
virtual OUString get_active_id() const = 0;
virtual void set_active_id(const OUString& rStr) = 0;
virtual OUString get_text(int pos) const = 0;
virtual OUString get_id(int pos) const = 0;
virtual void insert_text(int pos, const OUString& rStr) = 0;
void append_text(const OUString& rStr) { insert_text(-1, rStr); }
virtual void insert(int pos, const OUString& rId, const OUString& rStr) = 0;
void append(const OUString& rId, const OUString& rStr) { insert(-1, rId, rStr); }
virtual void remove(int pos) = 0;
void remove_text(const OUString& rText) { remove(find_text(rText)); }
virtual int find_text(const OUString& rStr) const = 0;
void remove_id(const OUString& rId) { remove(find_id(rId)); }
virtual int find_id(const OUString& rId) const = 0;
virtual int get_count() const = 0;
virtual void make_sorted() = 0;
virtual void clear() = 0;
virtual void set_entry_error(bool bError) = 0;
//by index
virtual int get_active() const = 0;
virtual void set_active(int pos) = 0;
virtual void remove(int pos) = 0;
//by text
virtual OUString get_active_text() const = 0;
void set_active_text(const OUString& rStr) { set_active(find_text(rStr)); }
virtual OUString get_text(int pos) const = 0;
virtual int find_text(const OUString& rStr) const = 0;
void remove_text(const OUString& rText) { remove(find_text(rText)); }
//by id
virtual OUString get_active_id() const = 0;
virtual void set_active_id(const OUString& rStr) = 0;
virtual OUString get_id(int pos) const = 0;
virtual int find_id(const OUString& rId) const = 0;
void remove_id(const OUString& rId) { remove(find_id(rId)); }
void connect_changed(const Link<ComboBoxText&, void>& rLink) { m_aChangeHdl = rLink; }
void set_active_text(const OUString& rStr) { set_active(find_text(rStr)); }
//entry related
virtual bool has_entry() const = 0;
virtual void set_entry_error(bool bError) = 0;
virtual void set_entry_text(const OUString& rStr) = 0;
virtual void set_entry_width_chars(int nChars) = 0;
virtual void select_entry_region(int nStartPos, int nEndPos) = 0;
virtual bool get_entry_selection_bounds(int& rStartPos, int& rEndPos) = 0;
virtual void set_entry_completion(bool bEnable) = 0;
@@ -496,6 +504,7 @@
virtual void set_position(int nCursorPos) = 0;
virtual void set_editable(bool bEditable) = 0;
virtual bool get_editable() const = 0;
virtual void set_error(bool bShowError) = 0;
virtual vcl::Font get_font() = 0;
virtual void set_font(const vcl::Font& rFont) = 0;
@@ -581,6 +590,83 @@
static unsigned int Power10(unsigned int n);
};
// an entry + treeview pair, where the entry autocompletes from the
// treeview list, and selecting something in the list sets the
// entry to that text, i.e. a visually exploded ComboBox
class VCL_DLLPUBLIC EntryTreeView : virtual public ComboBoxText
{
private:
DECL_DLLPRIVATE_LINK(ClickHdl, weld::TreeView&, void);
DECL_DLLPRIVATE_LINK(ModifyHdl, weld::Entry&, void);
void EntryModifyHdl(weld::Entry& rEntry);
protected:
std::unique_ptr<Entry> m_xEntry;
std::unique_ptr<TreeView> m_xTreeView;
public:
EntryTreeView(std::unique_ptr<Entry> xEntry, std::unique_ptr<TreeView> xTreeView);
virtual void insert_text(int pos, const OUString& rStr) override
{
m_xTreeView->insert_text(rStr, pos);
}
virtual void insert(int pos, const OUString& rId, const OUString& rStr) override
{
m_xTreeView->insert(pos, rId, rStr, OUString());
}
virtual int get_count() const override { return m_xTreeView->n_children(); }
virtual void clear() override { m_xTreeView->clear(); }
//by index
virtual int get_active() const override { return m_xTreeView->get_selected_index(); }
virtual void set_active(int pos) override
{
m_xTreeView->select(pos);
m_xEntry->set_text(m_xTreeView->get_selected_text());
}
virtual void remove(int pos) override { m_xTreeView->remove(pos); }
//by text
virtual OUString get_active_text() const override { return m_xEntry->get_text(); }
virtual OUString get_text(int pos) const override { return m_xTreeView->get_text(pos); }
virtual int find_text(const OUString& rStr) const override
{
return m_xTreeView->find_text(rStr);
}
//by id
virtual OUString get_active_id() const override { return m_xTreeView->get_selected_id(); }
virtual void set_active_id(const OUString& rStr) override
{
m_xTreeView->select_id(rStr);
m_xEntry->set_text(m_xTreeView->get_selected_text());
}
virtual OUString get_id(int pos) const override { return m_xTreeView->get_id(pos); }
virtual int find_id(const OUString& rId) const override { return m_xTreeView->find_id(rId); }
//entry related
virtual bool has_entry() const override { return true; }
virtual void set_entry_error(bool bError) override { m_xEntry->set_error(bError); }
virtual void set_entry_text(const OUString& rStr) override { m_xEntry->set_text(rStr); }
virtual void set_entry_width_chars(int nChars) override { m_xEntry->set_width_chars(nChars); }
virtual void select_entry_region(int nStartPos, int nEndPos) override
{
m_xEntry->select_region(nStartPos, nEndPos);
}
virtual bool get_entry_selection_bounds(int& rStartPos, int& rEndPos) override
{
return m_xEntry->get_selection_bounds(rStartPos, rEndPos);
}
void connect_row_activated(const Link<TreeView&, void>& rLink)
{
m_xTreeView->connect_row_activated(rLink);
}
void set_height_request_by_rows(int nRows);
};
class VCL_DLLPUBLIC MetricSpinButton
{
protected:
@@ -611,6 +697,8 @@
spin_button_output(*m_xSpinButton);
}
static OUString MetricToString(FieldUnit rUnit);
FieldUnit get_unit() const { return m_eSrcUnit; }
void set_unit(FieldUnit eUnit)
@@ -901,33 +989,6 @@
virtual Point get_accessible_location() = 0;
};
// an entry + treeview pair, where the entry autocompletes from the
// treeview list, and selecting something in the list sets the
// entry to that text
class VCL_DLLPUBLIC EntryTreeView
{
private:
DECL_DLLPRIVATE_LINK(ClickHdl, weld::TreeView&, void);
DECL_DLLPRIVATE_LINK(ModifyHdl, weld::Entry&, void);
void EntryModifyHdl(weld::Entry& rEntry);
protected:
Link<Entry&, void> m_aChangeHdl;
std::unique_ptr<Entry> m_xEntry;
std::unique_ptr<TreeView> m_xTreeView;
public:
EntryTreeView(std::unique_ptr<Entry> xEntry, std::unique_ptr<TreeView> xTreeView);
OUString get_text() const { return m_xEntry->get_text(); }
void append_text(const OUString& rText) { m_xTreeView->append_text(rText); }
void connect_row_activated(const Link<TreeView&, void>& rLink)
{
m_xTreeView->connect_row_activated(rLink);
}
void connect_changed(const Link<Entry&, void>& rLink) { m_aChangeHdl = rLink; }
void set_size_request_by_digits_rows(int nDigits, int nRows);
};
class VCL_DLLPUBLIC Menu
{
public:
@@ -1019,9 +1080,9 @@
FactoryFunction pUITestFactoryFunction = nullptr, void* pUserData = nullptr,
bool bTakeOwnership = false)
= 0;
virtual std::unique_ptr<EntryTreeView> weld_entry_tree_view(const OString& entryid,
const OString& treeviewid,
bool bTakeOwnership = false)
virtual std::unique_ptr<EntryTreeView>
weld_entry_tree_view(const OString& containerid, const OString& entryid,
const OString& treeviewid, bool bTakeOwnership = false)
= 0;
virtual std::unique_ptr<Menu> weld_menu(const OString& id, bool bTakeOwnership = true) = 0;
virtual std::unique_ptr<SizeGroup> create_size_group() = 0;
diff --git a/sc/qa/uitest/calc_tests/formatCells.py b/sc/qa/uitest/calc_tests/formatCells.py
index ea5e9ee..a690286 100644
--- a/sc/qa/uitest/calc_tests/formatCells.py
+++ b/sc/qa/uitest/calc_tests/formatCells.py
@@ -135,12 +135,12 @@
xLangFontEast = xDialog.getChild("eastlanglb")
xLangFontCTL = xDialog.getChild("ctllanglb")
self.assertEqual(get_state_as_dict(xSizeFont)["Text"], "18")
self.assertEqual(get_state_as_dict(xSizeFontEast)["Text"], "18")
self.assertEqual(get_state_as_dict(xSizeFontCTL)["Text"], "18") #check font size
self.assertEqual(get_state_as_dict(xLangFont)["Text"], "\u202a[None]\u202c")
self.assertEqual(get_state_as_dict(xLangFontEast)["SelectEntryText"], "\u202a[None]\u202c")
self.assertEqual(get_state_as_dict(xLangFontCTL)["SelectEntryText"], "\u202a[None]\u202c")
self.assertEqual(get_state_as_dict(xSizeFont)["Text"], "18 pt")
self.assertEqual(get_state_as_dict(xSizeFontEast)["Text"], "18 pt")
self.assertEqual(get_state_as_dict(xSizeFontCTL)["Text"], "18 pt") #check font size
self.assertEqual(get_state_as_dict(xLangFont)["Text"], "[None]")
self.assertEqual(get_state_as_dict(xLangFontEast)["SelectEntryText"], "[None]")
self.assertEqual(get_state_as_dict(xLangFontCTL)["SelectEntryText"], "[None]")
xCanc = xDialog.getChild("cancel")
self.ui_test.close_dialog_through_button(xCanc)
@@ -417,4 +417,4 @@
self.ui_test.close_dialog_through_button(xOKBtn)
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx
index c97a0be..c9b488f 100644
--- a/sc/source/ui/dbgui/tpsort.cxx
+++ b/sc/source/ui/dbgui/tpsort.cxx
@@ -623,7 +623,7 @@
LanguageType eLang = LanguageTag::convertToLanguageType( aSortData.aCollatorLocale, false);
if ( eLang == LANGUAGE_DONTKNOW )
eLang = LANGUAGE_SYSTEM;
m_xLbLanguage->SelectLanguage( eLang );
m_xLbLanguage->set_active_id(eLang);
FillAlgor(); // get algorithms, select default
if ( !aSortData.aCollatorAlgorithm.isEmpty() )
m_xLbAlgorithm->set_active_text(m_xColRes->GetTranslation(aSortData.aCollatorAlgorithm));
@@ -685,7 +685,7 @@
: 0;
// get locale
LanguageType eLang = m_xLbLanguage->GetSelectedLanguage();
LanguageType eLang = m_xLbLanguage->get_active_id();
aNewSortData.aCollatorLocale = LanguageTag::convertToLocale( eLang, false);
// get algorithm
@@ -877,7 +877,7 @@
m_xLbAlgorithm->freeze();
m_xLbAlgorithm->clear();
LanguageType eLang = m_xLbLanguage->GetSelectedLanguage();
LanguageType eLang = m_xLbLanguage->get_active_id();
if ( eLang == LANGUAGE_SYSTEM )
{
// for LANGUAGE_SYSTEM no algorithm can be selected because
diff --git a/sd/source/ui/dlg/dlgfield.cxx b/sd/source/ui/dlg/dlgfield.cxx
index 2b0ec21..f02d134 100644
--- a/sd/source/ui/dlg/dlgfield.cxx
+++ b/sd/source/ui/dlg/dlgfield.cxx
@@ -157,7 +157,7 @@
void SdModifyFieldDlg::FillFormatList()
{
LanguageType eLangType = m_xLbLanguage->GetSelectedLanguage();
LanguageType eLangType = m_xLbLanguage->get_active_id();
m_xLbFormat->clear();
@@ -293,9 +293,9 @@
const SfxPoolItem* pItem;
if( SfxItemState::SET == m_aInputSet.GetItemState(EE_CHAR_LANGUAGE, true, &pItem ) )
m_xLbLanguage->SelectLanguage( static_cast<const SvxLanguageItem*>(pItem)->GetLanguage() );
m_xLbLanguage->set_active_id(static_cast<const SvxLanguageItem*>(pItem)->GetLanguage());
m_xLbLanguage->save_value();
m_xLbLanguage->save_active_id();
FillFormatList();
m_xLbFormat->save_value();
@@ -310,9 +310,9 @@
{
SfxItemSet aOutput( *m_aInputSet.GetPool(), svl::Items<EE_CHAR_LANGUAGE, EE_CHAR_LANGUAGE_CTL>{} );
if( m_xLbLanguage->get_value_changed_from_saved() )
if (m_xLbLanguage->get_active_id_changed_from_saved())
{
LanguageType eLangType = m_xLbLanguage->GetSelectedLanguage();
LanguageType eLangType = m_xLbLanguage->get_active_id();
SvxLanguageItem aItem( eLangType, EE_CHAR_LANGUAGE );
aOutput.Put( aItem );
diff --git a/sfx2/source/dialog/newstyle.cxx b/sfx2/source/dialog/newstyle.cxx
index 38cd472..24d0f57 100644
--- a/sfx2/source/dialog/newstyle.cxx
+++ b/sfx2/source/dialog/newstyle.cxx
@@ -29,7 +29,7 @@
IMPL_LINK_NOARG(SfxNewStyleDlg, OKClickHdl, weld::Button&, void)
{
const OUString aName(m_xColBox->get_text());
const OUString aName(m_xColBox->get_active_text());
SfxStyleSheetBase* pStyle = m_rPool.Find(aName, m_rPool.GetSearchFamily());
if ( pStyle )
{
@@ -54,20 +54,21 @@
OKClickHdl(*m_xOKBtn);
}
IMPL_LINK(SfxNewStyleDlg, ModifyHdl, weld::Entry&, rBox, void)
IMPL_LINK(SfxNewStyleDlg, ModifyHdl, weld::ComboBoxText&, rBox, void)
{
m_xOKBtn->set_sensitive(!rBox.get_text().replaceAll(" ", "").isEmpty());
m_xOKBtn->set_sensitive(!rBox.get_active_text().replaceAll(" ", "").isEmpty());
}
SfxNewStyleDlg::SfxNewStyleDlg(weld::Window* pParent, SfxStyleSheetBasePool& rInPool)
: GenericDialogController(pParent, "sfx/ui/newstyle.ui", "CreateStyleDialog")
, m_rPool(rInPool)
, m_xColBox(m_xBuilder->weld_entry_tree_view("stylename", "styles"))
, m_xColBox(m_xBuilder->weld_entry_tree_view("stylegrid", "stylename", "styles"))
, m_xOKBtn(m_xBuilder->weld_button("ok"))
, m_xQueryOverwriteBox(Application::CreateMessageDialog(m_xDialog.get(), VclMessageType::Question, VclButtonsType::YesNo,
SfxResId(STR_QUERY_OVERWRITE)))
{
m_xColBox->set_size_request_by_digits_rows(20, 8);
m_xColBox->set_entry_width_chars(20);
m_xColBox->set_height_request_by_rows(8);
m_xOKBtn->connect_clicked(LINK(this, SfxNewStyleDlg, OKClickHdl));
m_xColBox->connect_changed(LINK(this, SfxNewStyleDlg, ModifyHdl));
diff --git a/sfx2/uiconfig/ui/newstyle.ui b/sfx2/uiconfig/ui/newstyle.ui
index 86ad1f1..5f7d08d 100644
--- a/sfx2/uiconfig/ui/newstyle.ui
+++ b/sfx2/uiconfig/ui/newstyle.ui
@@ -111,7 +111,7 @@
<property name="top_padding">6</property>
<property name="left_padding">12</property>
<child>
<object class="GtkGrid">
<object class="GtkGrid" id="stylegrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
diff --git a/solenv/sanitizers/ui/cui.suppr b/solenv/sanitizers/ui/cui.suppr
index 2087ab7..33bdc4c 100644
--- a/solenv/sanitizers/ui/cui.suppr
+++ b/solenv/sanitizers/ui/cui.suppr
@@ -79,6 +79,9 @@
cui/uiconfig/ui/charnamepage.ui://GtkLabel[@id='westfontinfo-cjk'] orphan-label
cui/uiconfig/ui/charnamepage.ui://GtkLabel[@id='eastfontinfo'] orphan-label
cui/uiconfig/ui/charnamepage.ui://GtkLabel[@id='ctlfontinfo'] orphan-label
cui/uiconfig/ui/charnamepage.ui://GtkEntry[@id='westfontname-nocjk'] no-labelled-by
cui/uiconfig/ui/charnamepage.ui://GtkEntry[@id='weststyle-nocjk'] no-labelled-by
cui/uiconfig/ui/charnamepage.ui://GtkEntry[@id='westsize-nocjk'] no-labelled-by
cui/uiconfig/ui/colorconfigwin.ui://GtkLabel[@id='doccolor'] orphan-label
cui/uiconfig/ui/colorconfigwin.ui://svxcorelo-SvxColorListBox[@id='doccolor_lb'] no-labelled-by
cui/uiconfig/ui/colorconfigwin.ui://svxcorelo-SvxColorListBox[@id='docboundaries_lb'] no-labelled-by
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index 20da4fc..3335514 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -1222,6 +1222,161 @@
}
}
SvtFontStyleBox::SvtFontStyleBox(std::unique_ptr<weld::ComboBoxText> p)
: m_xComboBox(std::move(p))
{
//Use the standard texts to get an optimal size and stick to that size.
//That should stop the character dialog dancing around.
auto nMaxLen = m_xComboBox->get_pixel_size(SvtResId(STR_SVT_STYLE_LIGHT)).Width();
nMaxLen = std::max(nMaxLen, m_xComboBox->get_pixel_size(SvtResId(STR_SVT_STYLE_LIGHT_ITALIC)).Width());
nMaxLen = std::max(nMaxLen, m_xComboBox->get_pixel_size(SvtResId(STR_SVT_STYLE_NORMAL)).Width());
nMaxLen = std::max(nMaxLen, m_xComboBox->get_pixel_size(SvtResId(STR_SVT_STYLE_NORMAL_ITALIC)).Width());
nMaxLen = std::max(nMaxLen, m_xComboBox->get_pixel_size(SvtResId(STR_SVT_STYLE_BOLD)).Width());
nMaxLen = std::max(nMaxLen, m_xComboBox->get_pixel_size(SvtResId(STR_SVT_STYLE_BOLD_ITALIC)).Width());
nMaxLen = std::max(nMaxLen, m_xComboBox->get_pixel_size(SvtResId(STR_SVT_STYLE_BLACK)).Width());
nMaxLen = std::max(nMaxLen, m_xComboBox->get_pixel_size(SvtResId(STR_SVT_STYLE_BLACK_ITALIC)).Width());
m_xComboBox->set_entry_width_chars(std::ceil(nMaxLen / m_xComboBox->get_approximate_digit_width()));
}
void SvtFontStyleBox::Fill( const OUString& rName, const FontList* pList )
{
m_xComboBox->freeze();
OUString aOldText = m_xComboBox->get_active_text();
int nPos = m_xComboBox->get_active();
m_xComboBox->clear();
// does a font with this name already exist?
sal_Handle hFontMetric = pList->GetFirstFontMetric( rName );
if ( hFontMetric )
{
OUString aStyleText;
FontWeight eLastWeight = WEIGHT_DONTKNOW;
FontItalic eLastItalic = ITALIC_NONE;
FontWidth eLastWidth = WIDTH_DONTKNOW;
bool bNormal = false;
bool bItalic = false;
bool bBold = false;
bool bBoldItalic = false;
bool bInsert = false;
FontMetric aFontMetric;
while ( hFontMetric )
{
aFontMetric = FontList::GetFontMetric( hFontMetric );
FontWeight eWeight = aFontMetric.GetWeight();
FontItalic eItalic = aFontMetric.GetItalic();
FontWidth eWidth = aFontMetric.GetWidthType();
// Only if the attributes are different, we insert the
// Font to avoid double Entries in different languages
if ( (eWeight != eLastWeight) || (eItalic != eLastItalic) ||
(eWidth != eLastWidth) )
{
if ( bInsert )
m_xComboBox->append_text(aStyleText);
if ( eWeight <= WEIGHT_NORMAL )
{
if ( eItalic != ITALIC_NONE )
bItalic = true;
else
bNormal = true;
}
else
{
if ( eItalic != ITALIC_NONE )
bBoldItalic = true;
else
bBold = true;
}
// For wrong StyleNames we replace this with the correct once
aStyleText = pList->GetStyleName( aFontMetric );
bInsert = m_xComboBox->find_text(aStyleText) == -1;
if ( !bInsert )
{
aStyleText = pList->GetStyleName( eWeight, eItalic );
bInsert = m_xComboBox->find_text(aStyleText) == -1;
}
eLastWeight = eWeight;
eLastItalic = eItalic;
eLastWidth = eWidth;
}
else
{
if ( bInsert )
{
// If we have two names for the same attributes
// we prefer the translated standard names
const OUString& rAttrStyleText = pList->GetStyleName( eWeight, eItalic );
if (rAttrStyleText != aStyleText)
{
OUString aTempStyleText = pList->GetStyleName( aFontMetric );
if (rAttrStyleText == aTempStyleText)
aStyleText = rAttrStyleText;
bInsert = m_xComboBox->find_text(aStyleText) == -1;
}
}
}
if ( !bItalic && (aStyleText == pList->GetItalicStr()) )
bItalic = true;
else if ( !bBold && (aStyleText == pList->GetBoldStr()) )
bBold = true;
else if ( !bBoldItalic && (aStyleText == pList->GetBoldItalicStr()) )
bBoldItalic = true;
hFontMetric = FontList::GetNextFontMetric( hFontMetric );
}
if ( bInsert )
m_xComboBox->append_text(aStyleText);
// certain style as copy
if ( bNormal )
{
if ( !bItalic )
m_xComboBox->append_text(pList->GetItalicStr());
if ( !bBold )
m_xComboBox->append_text(pList->GetBoldStr());
}
if ( !bBoldItalic )
{
if ( bNormal || bItalic || bBold )
m_xComboBox->append_text(pList->GetBoldItalicStr());
}
if (!aOldText.isEmpty())
{
int nFound = m_xComboBox->find_text(aOldText);
if (nFound != -1)
m_xComboBox->set_active(nFound);
else
{
if (nPos >= m_xComboBox->get_count())
m_xComboBox->set_active(0);
else
m_xComboBox->set_active(nPos);
}
}
}
else
{
// insert standard styles if no font
m_xComboBox->append_text(pList->GetNormalStr());
m_xComboBox->append_text(pList->GetItalicStr());
m_xComboBox->append_text(pList->GetBoldStr());
m_xComboBox->append_text(pList->GetBoldItalicStr());
if (!aOldText.isEmpty())
{
if (nPos >= m_xComboBox->get_count())
m_xComboBox->set_active(0);
else
m_xComboBox->set_active(nPos);
}
}
m_xComboBox->thaw();
}
FontSizeBox::FontSizeBox( vcl::Window* pParent, WinBits nWinSize ) :
MetricBox( pParent, nWinSize )
{
@@ -1543,6 +1698,341 @@
return MetricBox::GetValueFromStringUnit( rStr, eOutUnit );
}
SvtFontSizeBox::SvtFontSizeBox(std::unique_ptr<weld::ComboBoxText> p)
: pFontList(nullptr)
, nSavedValue(0)
, nMin(20)
, nMax(9999)
, eUnit(FUNIT_POINT)
, nDecimalDigits(1)
, nRelMin(0)
, nRelMax(0)
, nRelStep(0)
, nPtRelMin(0)
, nPtRelMax(0)
, nPtRelStep(0)
, bRelativeMode(false)
, bRelative(false)
, bPtRelative(false)
, bStdSize(false)
, m_xComboBox(std::move(p))
{
m_xComboBox->set_entry_width_chars(std::ceil(m_xComboBox->get_pixel_size(format_number(105)).Width() /
m_xComboBox->get_approximate_digit_width()));
m_xComboBox->connect_focus_out(LINK(this, SvtFontSizeBox, ReformatHdl));
m_xComboBox->connect_changed(LINK(this, SvtFontSizeBox, ModifyHdl));
}
IMPL_LINK_NOARG(SvtFontSizeBox, ReformatHdl, weld::Widget&, void)
{
FontSizeNames aFontSizeNames(Application::GetSettings().GetUILanguageTag().getLanguageType());
if (!bRelativeMode || !aFontSizeNames.IsEmpty())
{
if (aFontSizeNames.Name2Size(m_xComboBox->get_active_text()) != 0)
return;
}
set_value(get_value());
}
IMPL_LINK(SvtFontSizeBox, ModifyHdl, weld::ComboBoxText&, rBox, void)
{
if (bRelativeMode)
{
OUString aStr = comphelper::string::stripStart(rBox.get_active_text(), ' ');
bool bNewMode = bRelative;
bool bOldPtRelMode = bPtRelative;
if ( bRelative )
{
bPtRelative = false;
const sal_Unicode* pStr = aStr.getStr();
while ( *pStr )
{
if ( ((*pStr < '0') || (*pStr > '9')) && (*pStr != '%') && !unicode::isSpace(*pStr) )
{
if ( ('-' == *pStr || '+' == *pStr) && !bPtRelative )
bPtRelative = true;
else if ( bPtRelative && 'p' == *pStr && 't' == *++pStr )
;
else
{
bNewMode = false;
break;
}
}
pStr++;
}
}
else if (!aStr.isEmpty())
{
if ( -1 != aStr.indexOf('%') )
{
bNewMode = true;
bPtRelative = false;
}
if ( '-' == aStr[0] || '+' == aStr[0] )
{
bNewMode = true;
bPtRelative = true;
}
}
if ( bNewMode != bRelative || bPtRelative != bOldPtRelMode )
SetRelative( bNewMode );
}
m_aChangeHdl.Call(rBox);
}
void SvtFontSizeBox::Fill( const FontMetric* pFontMetric, const FontList* pList )
{
// remember for relative mode
pFontList = pList;
// no font sizes need to be set for relative mode
if ( bRelative )
return;
// query font sizes
const sal_IntPtr* pTempAry;
const sal_IntPtr* pAry = nullptr;
if( pFontMetric )
{
aFontMetric = *pFontMetric;
pAry = pList->GetSizeAry( *pFontMetric );
}
else
{
pAry = FontList::GetStdSizeAry();
}
// first insert font size names (for simplified/traditional chinese)
FontSizeNames aFontSizeNames( Application::GetSettings().GetUILanguageTag().getLanguageType() );
if ( pAry == FontList::GetStdSizeAry() )
{
// for standard sizes we don't need to bother
if (bStdSize && m_xComboBox->get_count() && aFontSizeNames.IsEmpty())
return;
bStdSize = true;
}
else
bStdSize = false;
int nSelectionStart, nSelectionEnd;
m_xComboBox->get_entry_selection_bounds(nSelectionStart, nSelectionEnd);
OUString aStr = m_xComboBox->get_active_text();
m_xComboBox->freeze();
m_xComboBox->clear();
int nPos = 0;
if ( !aFontSizeNames.IsEmpty() )
{
if ( pAry == FontList::GetStdSizeAry() )
{
// for scalable fonts all font size names
sal_uLong nCount = aFontSizeNames.Count();
for( sal_uLong i = 0; i < nCount; i++ )
{
OUString aSizeName = aFontSizeNames.GetIndexName( i );
sal_IntPtr nSize = aFontSizeNames.GetIndexSize( i );
OUString sId(OUString::number(-nSize)); // mark as special
m_xComboBox->insert(nPos, sId, aSizeName);
nPos++;
}
}
else
{
// for fixed size fonts only selectable font size names
pTempAry = pAry;
while ( *pTempAry )
{
OUString aSizeName = aFontSizeNames.Size2Name( *pTempAry );
if ( !aSizeName.isEmpty() )
{
OUString sId(OUString::number(-(*pTempAry))); // mark as special
m_xComboBox->insert(nPos, sId, aSizeName);
nPos++;
}
pTempAry++;
}
}
}
// then insert numerical font size values
pTempAry = pAry;
while (*pTempAry)
{
InsertValue(*pTempAry);
++pTempAry;
}
m_xComboBox->set_entry_text(aStr);
m_xComboBox->select_entry_region(nSelectionStart, nSelectionEnd);
m_xComboBox->thaw();
}
void SvtFontSizeBox::EnableRelativeMode( sal_uInt16 nNewMin, sal_uInt16 nNewMax, sal_uInt16 nStep )
{
bRelativeMode = true;
nRelMin = nNewMin;
nRelMax = nNewMax;
nRelStep = nStep;
SetUnit(FUNIT_POINT);
}
void SvtFontSizeBox::EnablePtRelativeMode( short nNewMin, short nNewMax, short nStep )
{
bRelativeMode = true;
nPtRelMin = nNewMin;
nPtRelMax = nNewMax;
nPtRelStep = nStep;
SetUnit(FUNIT_POINT);
}
void SvtFontSizeBox::InsertValue(int i)
{
OUString sNumber(OUString::number(i));
m_xComboBox->append(sNumber, format_number(i));
}
void SvtFontSizeBox::SetRelative( bool bNewRelative )
{
if ( !bRelativeMode )
return;
int nSelectionStart, nSelectionEnd;
m_xComboBox->get_entry_selection_bounds(nSelectionStart, nSelectionEnd);
OUString aStr = comphelper::string::stripStart(m_xComboBox->get_active_text(), ' ');
if (bNewRelative)
{
bRelative = true;
bStdSize = false;
m_xComboBox->clear();
if (bPtRelative)
{
SetDecimalDigits( 1 );
SetRange(nPtRelMin, nPtRelMax);
SetUnit(FUNIT_POINT);
short i = nPtRelMin, n = 0;
// JP 30.06.98: more than 100 values are not useful
while ( i <= nPtRelMax && n++ < 100 )
{
InsertValue( i );
i = i + nPtRelStep;
}
}
else
{
SetDecimalDigits(0);
SetRange(nRelMin, nRelMax);
SetUnit(FUNIT_PERCENT);
sal_uInt16 i = nRelMin;
while ( i <= nRelMax )
{
InsertValue( i );
i = i + nRelStep;
}
}
}
else
{
if (pFontList)
m_xComboBox->clear();
bRelative = bPtRelative = false;
SetDecimalDigits(1);
SetRange(20, 9999);
SetUnit(FUNIT_POINT);
if ( pFontList)
Fill( &aFontMetric, pFontList );
}
m_xComboBox->set_entry_text(aStr);
m_xComboBox->select_entry_region(nSelectionStart, nSelectionEnd);
}
OUString SvtFontSizeBox::format_number(int nValue) const
{
OUString sRet;
//pawn percent off to icu to decide whether percent is separated from its number for this locale
if (eUnit == FUNIT_PERCENT)
{
double fValue = nValue;
fValue /= weld::SpinButton::Power10(nDecimalDigits);
sRet = unicode::formatPercent(fValue, Application::GetSettings().GetUILanguageTag());
}
else
{
const SvtSysLocale aSysLocale;
const LocaleDataWrapper& rLocaleData = aSysLocale.GetLocaleData();
sRet = rLocaleData.getNum(nValue, nDecimalDigits, true, false);
if (eUnit != FUNIT_NONE && eUnit != FUNIT_DEGREE)
sRet += " ";
assert(eUnit != FUNIT_PERCENT);
sRet += weld::MetricSpinButton::MetricToString(eUnit);
}
if (bRelativeMode && bPtRelative && (0 <= nValue) && !sRet.isEmpty())
sRet = "+" + sRet;
return sRet;
}
void SvtFontSizeBox::SetValue(int nNewValue, FieldUnit eInUnit)
{
auto nTempValue = MetricField::ConvertValue(nNewValue, 0, GetDecimalDigits(), eInUnit, GetUnit());
if (!bRelative)
{
FontSizeNames aFontSizeNames(Application::GetSettings().GetUILanguageTag().getLanguageType());
// conversion loses precision; however font sizes should
// never have a problem with that
OUString aName = aFontSizeNames.Size2Name(nTempValue);
if (!aName.isEmpty() && m_xComboBox->find_text(aName) != -1)
{
m_xComboBox->set_active_text(aName);
return;
}
}
OUString aResult = format_number(nTempValue);
const int nFound = m_xComboBox->find_text(aResult);
if (nFound != -1)
m_xComboBox->set_active(nFound);
else
m_xComboBox->set_entry_text(aResult);
}
void SvtFontSizeBox::set_value(int nNewValue)
{
SetValue(nNewValue, eUnit);
}
int SvtFontSizeBox::get_value() const
{
OUString aStr = m_xComboBox->get_active_text();
if (!bRelative)
{
FontSizeNames aFontSizeNames(Application::GetSettings().GetUILanguageTag().getLanguageType());
auto nValue = aFontSizeNames.Name2Size(aStr);
if (nValue)
return MetricField::ConvertValue(nValue, 0, GetDecimalDigits(), GetUnit(), GetUnit());
}
const SvtSysLocale aSysLocale;
const LocaleDataWrapper& rLocaleData = aSysLocale.GetLocaleData();
double fResult(0.0);
MetricFormatter::TextToValue(aStr, fResult, 0, GetDecimalDigits(), rLocaleData, GetUnit());
return fResult;
}
SvxBorderLineStyle SvtLineListBox::GetSelectEntryStyle() const
{
if (m_xLineSet->IsNoSelection())
diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx
index d3619fb..bb4768c 100644
--- a/svx/source/dialog/langbox.cxx
+++ b/svx/source/dialog/langbox.cxx
@@ -528,7 +528,7 @@
return ImplGetSavedValue();
}
LanguageType LanguageBox::GetSelectedLanguage() const
LanguageType LanguageBox::get_active_id() const
{
OUString sLang = m_xControl->get_active_id();
if (!sLang.isEmpty())
@@ -537,7 +537,7 @@
return LANGUAGE_DONTKNOW;
}
void LanguageBox::SelectLanguage( const LanguageType eLangType )
void LanguageBox::set_active_id(const LanguageType eLangType)
{
// If the core uses a LangID of an imported MS document and wants to select
// a language that is replaced, we need to select the replacement instead.
@@ -579,12 +579,13 @@
}
void LanguageBox::SetLanguageList( SvxLanguageListFlags nLangList,
bool bHasLangNone, bool bLangNoneIsLangAll )
bool bHasLangNone, bool bLangNoneIsLangAll, bool bCheckSpellAvail )
{
ImplClear();
m_bHasLangNone = bHasLangNone;
m_bLangNoneIsLangAll = bLangNoneIsLangAll;
m_bWithCheckmark = bCheckSpellAvail;
if ( SvxLanguageListFlags::EMPTY == nLangList )
return;
@@ -734,31 +735,90 @@
aStrEntry += SvtLanguageTable::GetLanguageString( nRealLang );
}
// aStrEntry = ApplyLreOrRleEmbedding( aStrEntry );
m_xControl->append(OUString::number(static_cast<sal_uInt16>(nLangType)), aStrEntry);
}
IMPL_LINK(LanguageBox, ChangeHdl, weld::ComboBoxText&, rControl, void)
{
int nModelPos = rControl.find_text(rControl.get_active_text());
if (nModelPos == -1)
if (rControl.has_entry())
{
rControl.set_entry_error(true);
EditedAndValid eOldState = m_eEditedAndValid;
OUString aStr(rControl.get_active_text());
if (aStr.isEmpty())
m_eEditedAndValid = EditedAndValid::Invalid;
else
{
const int nPos = rControl.find_text(aStr);
if (nPos != -1)
{
int nStartSelectPos, nEndSelectPos;
rControl.get_entry_selection_bounds(nStartSelectPos, nEndSelectPos);
// Select the corresponding listbox entry if not current. This
// invalidates the Edit Selection thus has to happen between
// obtaining the Selection and setting the new Selection.
int nSelPos = m_xControl->get_active();
bool bSetEditSelection;
if (nSelPos == nPos)
bSetEditSelection = false;
else
{
m_xControl->set_active(nPos);
bSetEditSelection = true;
}
// If typing into the Edit control led us here, advance start of a
// full selection by one so the next character will already
// continue the string instead of having to type the same character
// again to start a new string. The selection is in reverse
// when obtained from the Edit control.
if (nEndSelectPos == 0)
{
OUString aText(m_xControl->get_active_text());
if (nStartSelectPos == aText.getLength())
{
++nEndSelectPos;
bSetEditSelection = true;
}
}
if (bSetEditSelection)
rControl.select_entry_region(nStartSelectPos, nEndSelectPos);
m_eEditedAndValid = EditedAndValid::No;
}
else
{
OUString aCanonicalized;
bool bValid = LanguageTag::isValidBcp47( aStr, &aCanonicalized, true);
m_eEditedAndValid = (bValid ? EditedAndValid::Valid : EditedAndValid::Invalid);
if (bValid && aCanonicalized != aStr)
{
m_xControl->set_entry_text(aCanonicalized);
const auto nCursorPos = aCanonicalized.getLength();
m_xControl->select_entry_region(nCursorPos, nCursorPos);
}
}
}
if (eOldState != m_eEditedAndValid)
{
if (m_eEditedAndValid == EditedAndValid::Invalid)
rControl.set_entry_error(true);
else
rControl.set_entry_error(false);
}
}
else
{
rControl.set_active(nModelPos);
rControl.set_entry_error(false);
m_aChangeHdl.Call(rControl);
}
m_aChangeHdl.Call(rControl);
}
LanguageBox::LanguageBox(std::unique_ptr<weld::ComboBoxText> pControl)
: m_xControl(std::move(pControl))
, m_aAllString(SvxResId(RID_SVXSTR_LANGUAGE_ALL))
, m_eSavedLanguage(LANGUAGE_DONTKNOW)
, m_eEditedAndValid(EditedAndValid::No)
, m_bHasLangNone(false)
, m_bLangNoneIsLangAll(false)
, m_bWithCheckmark(false)
{
m_xControl->make_sorted();
m_xControl->connect_changed(LINK(this, LanguageBox, ChangeHdl));
@@ -1091,4 +1151,40 @@
return nPos;
}
sal_Int32 LanguageBox::SaveEditedAsEntry()
{
if (m_eEditedAndValid != EditedAndValid::Valid)
return -1;
LanguageTag aLanguageTag(m_xControl->get_active_text());
LanguageType nLang = aLanguageTag.getLanguageType();
if (nLang == LANGUAGE_DONTKNOW)
{
SAL_WARN( "svx.dialog", "SvxLanguageComboBox::SaveEditedAsEntry: unknown tag");
return -1;
}
int nPos = ImplTypeToPos( nLang);
if (nPos != -1)
return nPos; // Already present but with a different string.
if (SvtLanguageTable::HasLanguageType( nLang))
{
// In SvtLanguageTable but not in SvxLanguageComboBox. On purpose? This
// may be an entry with different settings or CTL instead of Western or
// ... all things we don't handle yet.
SAL_WARN( "svx.dialog", "SvxLanguageComboBox::SaveEditedAsEntry: already in SvtLanguageTable: " <<
SvtLanguageTable::GetLanguageString( nLang) << ", " << nLang);
}
else
{
// Add to both, SvtLanguageTable and SvxLanguageComboBox.
/* TODO: a descriptive user comment would be a nice to have here. */
SvtLanguageTable::AddLanguageTag( aLanguageTag );
}
InsertLanguage(nLang);
return ImplTypeToPos(nLang);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/uitest/writer_tests2/formatCharacter.py b/sw/qa/uitest/writer_tests2/formatCharacter.py
index 6cd06ad..03dc112 100644
--- a/sw/qa/uitest/writer_tests2/formatCharacter.py
+++ b/sw/qa/uitest/writer_tests2/formatCharacter.py
@@ -57,12 +57,12 @@
xLangFontEast = xDialog.getChild("eastlanglb")
xLangFontCTL = xDialog.getChild("ctllanglb")
self.assertEqual(get_state_as_dict(xSizeFont)["Text"], "18")
self.assertEqual(get_state_as_dict(xSizeFontEast)["Text"], "18")
self.assertEqual(get_state_as_dict(xSizeFontCTL)["Text"], "18") #check font size
self.assertEqual(get_state_as_dict(xLangFont)["Text"], "\u202a[None]\u202c")
self.assertEqual(get_state_as_dict(xLangFontEast)["SelectEntryText"], "\u202a[None]\u202c")
self.assertEqual(get_state_as_dict(xLangFontCTL)["SelectEntryText"], "\u202a[None]\u202c")
self.assertEqual(get_state_as_dict(xSizeFont)["Text"], "18 pt")
self.assertEqual(get_state_as_dict(xSizeFontEast)["Text"], "18 pt")
self.assertEqual(get_state_as_dict(xSizeFontCTL)["Text"], "18 pt") #check font size
self.assertEqual(get_state_as_dict(xLangFont)["Text"], "[None]")
self.assertEqual(get_state_as_dict(xLangFontEast)["SelectEntryText"], "[None]")
self.assertEqual(get_state_as_dict(xLangFontCTL)["SelectEntryText"], "[None]")
xCanc = xDialog.getChild("cancel")
self.ui_test.close_dialog_through_button(xCanc)
diff --git a/sw/source/ui/dialog/ascfldlg.cxx b/sw/source/ui/dialog/ascfldlg.cxx
index 5c78092..bf7fed5 100644
--- a/sw/source/ui/dialog/ascfldlg.cxx
+++ b/sw/source/ui/dialog/ascfldlg.cxx
@@ -179,7 +179,7 @@
}
m_xLanguageLB->SetLanguageList( SvxLanguageListFlags::ALL, true );
m_xLanguageLB->SelectLanguage( aOpt.GetLanguage() );
m_xLanguageLB->set_active_id(aOpt.GetLanguage());
}
{
@@ -263,7 +263,7 @@
if (m_xFontLB->get_visible())
{
sFont = m_xFontLB->get_active_text();
nLng = m_xLanguageLB->GetSelectedLanguage();
nLng = m_xLanguageLB->get_active_id();
}
rOptions.SetFontName( sFont );
@@ -324,7 +324,7 @@
{
LineEnd eOldEnd = GetCRLF(), eEnd = LineEnd(-1);
LanguageType nLng = m_xFontLB->get_visible()
? m_xLanguageLB->GetSelectedLanguage()
? m_xLanguageLB->get_active_id()
: LANGUAGE_SYSTEM,
nOldLng = nLng;
@@ -391,7 +391,7 @@
m_bSaveLineStatus = true;
if (nOldLng != nLng && m_xFontLB->get_visible())
m_xLanguageLB->SelectLanguage( nLng );
m_xLanguageLB->set_active_id(nLng);
}
IMPL_LINK(SwAsciiFilterDlg, LineEndHdl, weld::ToggleButton&, rBtn, void)
diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx
index 0420bc9..7fa7e23 100644
--- a/sw/source/ui/misc/srtdlg.cxx
+++ b/sw/source/ui/misc/srtdlg.cxx
@@ -181,7 +181,7 @@
nLang = GetAppLanguage();
m_xLangLB->SetLanguageList( SvxLanguageListFlags::ALL | SvxLanguageListFlags::ONLY_KNOWN, true );
m_xLangLB->SelectLanguage( nLang );
m_xLangLB->set_active_id(nLang);
LanguageHdl( nullptr );
m_xLangLB->connect_changed( LINK( this, SwSortDlg, LanguageListBoxHdl ));
@@ -254,7 +254,7 @@
bAsc2 = m_xSortUp2RB->get_active();
bAsc3 = m_xSortUp3RB->get_active();
bCol = m_xColumnRB->get_active();
nLang = m_xLangLB->GetSelectedLanguage();
nLang = m_xLangLB->get_active_id();
cDeli = GetDelimChar();
bCsSens = m_xCaseCB->get_active();
@@ -384,7 +384,7 @@
void SwSortDlg::LanguageHdl(weld::ComboBoxText const* pLBox)
{
Sequence < OUString > aSeq( GetAppCollator().listCollatorAlgorithms(
LanguageTag( m_xLangLB->GetSelectedLanguage()).getLocale() ));
LanguageTag( m_xLangLB->get_active_id()).getLocale() ));
if (!m_xColRes)
m_xColRes.reset(new CollatorResource);
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index fe39d8b7..6e029a7 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -212,6 +212,7 @@
{
sw_CharDialogResult(pDlg->GetOutputItemSet(), rWrtSh, pCoreSet, bSel, bSelectionPut, pRequest.get());
}
pDlg->disposeOnce();
});
}
else if (pArgs)
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 473cc67..65eeaf8 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -186,12 +186,14 @@
DECL_LINK(FocusInListener, VclWindowEvent&, void);
DECL_LINK(FocusOutListener, VclWindowEvent&, void);
bool const m_bTakeOwnership;
const bool m_bTakeOwnership;
int m_nBlockNotify;
public:
SalInstanceWidget(vcl::Window* pWidget, bool bTakeOwnership)
: m_xWidget(pWidget)
, m_bTakeOwnership(bTakeOwnership)
, m_nBlockNotify(0)
{
}
@@ -436,6 +438,21 @@
return m_xWidget;
}
void disable_notify_events()
{
++m_nBlockNotify;
}
bool notify_events_disabled()
{
return m_nBlockNotify != 0;
}
void enable_notify_events()
{
--m_nBlockNotify;
}
SystemWindow* getSystemWindow()
{
return m_xWidget->GetSystemWindow();
@@ -1143,7 +1160,6 @@
{
private:
VclPtr<::RadioButton> m_xRadioButton;
bool m_bBlockNotify;
DECL_LINK(ToggleHdl, ::RadioButton&, void);
@@ -1151,16 +1167,15 @@
SalInstanceRadioButton(::RadioButton* pButton, bool bTakeOwnership)
: SalInstanceButton(pButton, bTakeOwnership)
, m_xRadioButton(pButton)
, m_bBlockNotify(false)
{
m_xRadioButton->SetToggleHdl(LINK(this, SalInstanceRadioButton, ToggleHdl));
}
virtual void set_active(bool active) override
{
m_bBlockNotify = true;
disable_notify_events();
m_xRadioButton->Check(active);
m_bBlockNotify = false;
enable_notify_events();
}
virtual bool get_active() const override
@@ -1186,7 +1201,7 @@
IMPL_LINK_NOARG(SalInstanceRadioButton, ToggleHdl, ::RadioButton&, void)
{
if (m_bBlockNotify)
if (notify_events_disabled())
return;
signal_toggled();
}
@@ -1195,7 +1210,6 @@
{
private:
VclPtr<PushButton> m_xToggleButton;
bool m_bBlockNotify;
DECL_LINK(ToggleListener, VclWindowEvent&, void);
@@ -1203,7 +1217,6 @@
SalInstanceToggleButton(PushButton* pButton, bool bTakeOwnership)
: SalInstanceButton(pButton, bTakeOwnership)
, m_xToggleButton(pButton)
, m_bBlockNotify(false)
{
}
@@ -1216,9 +1229,9 @@
virtual void set_active(bool active) override
{
m_bBlockNotify = true;
disable_notify_events();
m_xToggleButton->Check(active);
m_bBlockNotify = false;
enable_notify_events();
}
virtual bool get_active() const override
@@ -1228,9 +1241,9 @@
virtual void set_inconsistent(bool inconsistent) override
{
m_bBlockNotify = false;
disable_notify_events();
m_xToggleButton->SetState(inconsistent ? TRISTATE_INDET : TRISTATE_FALSE);
m_bBlockNotify = true;
enable_notify_events();
}
virtual bool get_inconsistent() const override
@@ -1247,7 +1260,7 @@
IMPL_LINK(SalInstanceToggleButton, ToggleListener, VclWindowEvent&, rEvent, void)
{
if (m_bBlockNotify)
if (notify_events_disabled())
return;
if (rEvent.GetId() == VclEventId::PushbuttonToggle)
signal_toggled();
@@ -1257,24 +1270,22 @@
{
private:
VclPtr<CheckBox> m_xCheckButton;
bool m_bBlockNotify;
DECL_LINK(ToggleHdl, CheckBox&, void);
public:
SalInstanceCheckButton(CheckBox* pButton, bool bTakeOwnership)
: SalInstanceButton(pButton, bTakeOwnership)
, m_xCheckButton(pButton)
, m_bBlockNotify(false)
{
m_xCheckButton->SetToggleHdl(LINK(this, SalInstanceCheckButton, ToggleHdl));
}
virtual void set_active(bool active) override
{
m_bBlockNotify = true;
disable_notify_events();
m_xCheckButton->EnableTriState(false);
m_xCheckButton->Check(active);
m_bBlockNotify = false;
enable_notify_events();
}
virtual bool get_active() const override
@@ -1284,10 +1295,10 @@
virtual void set_inconsistent(bool inconsistent) override
{
m_bBlockNotify = true;
disable_notify_events();
m_xCheckButton->EnableTriState(true);
m_xCheckButton->SetState(inconsistent ? TRISTATE_INDET : TRISTATE_FALSE);
m_bBlockNotify = false;
enable_notify_events();
}
virtual bool get_inconsistent() const override
@@ -1303,7 +1314,7 @@
IMPL_LINK_NOARG(SalInstanceCheckButton, ToggleHdl, CheckBox&, void)
{
if (m_bBlockNotify)
if (notify_events_disabled())
return;
m_xCheckButton->EnableTriState(false);
signal_toggled();
@@ -1455,6 +1466,14 @@
return !m_xEntry->IsReadOnly();
}
virtual void set_error(bool bError) override
{
if (bError)
m_xEntry->SetControlForeground(Color(0xf0, 0, 0));
else
m_xEntry->SetControlForeground();
}
virtual vcl::Font get_font() override
{
return m_xEntry->GetFont();
@@ -1472,9 +1491,14 @@
weld::Entry::connect_cursor_position(rLink);
}
void SetAutocompleteHdl(const Link<Edit&,void>& rLink)
Edit& getEntry()
{
m_xEntry->SetAutocompleteHdl(rLink);
return *m_xEntry;
}
void fire_signal_changed()
{
signal_changed();
}
virtual ~SalInstanceEntry() override
@@ -1660,6 +1684,11 @@
return m_xTreeView->CalcWindowSizePixel(nRows);
}
ListBox& getTreeView()
{
return *m_xTreeView;
}
virtual ~SalInstanceTreeView() override
{
m_xTreeView->SetDoubleClickHdl(Link<ListBox&, void>());
@@ -1669,11 +1698,15 @@
IMPL_LINK_NOARG(SalInstanceTreeView, SelectHdl, ListBox&, void)
{
if (notify_events_disabled())
return;
signal_changed();
}
IMPL_LINK_NOARG(SalInstanceTreeView, DoubleClickHdl, ListBox&, void)
{
if (notify_events_disabled())
return;
signal_row_activated();
}
@@ -2205,6 +2238,11 @@
m_xComboBoxText->RemoveEntry(pos);
}
virtual bool has_entry() const override
{
return false;
}
virtual void set_entry_error(bool /*bError*/) override
{
assert(false);
@@ -2226,6 +2264,11 @@
return false;
}
virtual void set_entry_width_chars(int /*nChars*/) override
{
assert(false);
}
virtual void set_entry_completion(bool) override
{
assert(false);
@@ -2255,6 +2298,11 @@
m_xComboBoxText->SetEntryActivateHdl(LINK(this, SalInstanceComboBoxTextWithEdit, EntryActivateHdl));
}
virtual bool has_entry() const override
{
return true;
}
virtual void set_entry_error(bool bError) override
{
if (bError)
@@ -2278,6 +2326,11 @@
m_xComboBoxText->SetText(rText);
}
virtual void set_entry_width_chars(int nChars) override
{
m_xComboBoxText->SetWidthInChars(nChars);
}
virtual void set_entry_completion(bool bEnable) override
{
m_xComboBoxText->EnableAutocomplete(bEnable);
@@ -2313,25 +2366,67 @@
m_aEntryActivateHdl.Call(*this);
}
class SalInstanceEntryTreeView : public weld::EntryTreeView
class SalInstanceEntryTreeView : public SalInstanceContainer, public virtual weld::EntryTreeView
{
private:
DECL_LINK(AutocompleteHdl, Edit&, void);
DECL_LINK(KeyPressListener, VclWindowEvent&, void);
SalInstanceEntry* m_pEntry;
SalInstanceTreeView* m_pTreeView;
public:
SalInstanceEntryTreeView(std::unique_ptr<weld::Entry> xEntry, std::unique_ptr<weld::TreeView> xTreeView)
SalInstanceEntryTreeView(vcl::Window *pContainer, bool bTakeOwnership, std::unique_ptr<weld::Entry> xEntry, std::unique_ptr<weld::TreeView> xTreeView)
: EntryTreeView(std::move(xEntry), std::move(xTreeView))
, SalInstanceContainer(pContainer, bTakeOwnership)
, m_pEntry(dynamic_cast<SalInstanceEntry*>(m_xEntry.get()))
, m_pTreeView(dynamic_cast<SalInstanceTreeView*>(m_xTreeView.get()))
{
assert(m_pEntry);
m_pEntry->SetAutocompleteHdl(LINK(this, SalInstanceEntryTreeView, AutocompleteHdl));
assert(m_pEntry && m_pTreeView);
Edit& rEntry = m_pEntry->getEntry();
rEntry.SetAutocompleteHdl(LINK(this, SalInstanceEntryTreeView, AutocompleteHdl));
rEntry.AddEventListener(LINK(this, SalInstanceEntryTreeView, KeyPressListener));
}
~SalInstanceEntryTreeView()
virtual void make_sorted() override
{
m_pEntry->SetAutocompleteHdl(Link<Edit&, void>());
vcl::Window *pTreeView = m_pTreeView->getWidget();
pTreeView->SetStyle(pTreeView->GetStyle() | WB_SORT);
}
virtual void set_entry_completion(bool bEnable) override
{
assert(!bEnable && "not implemented yet"); (void) bEnable;
Edit& rEntry = m_pEntry->getEntry();
rEntry.SetAutocompleteHdl(Link<Edit&, void>());
}
virtual ~SalInstanceEntryTreeView() override
{
Edit& rEntry = m_pEntry->getEntry();
rEntry.RemoveEventListener(LINK(this, SalInstanceEntryTreeView, KeyPressListener));
rEntry.SetAutocompleteHdl(Link<Edit&, void>());
}
};
IMPL_LINK(SalInstanceEntryTreeView, KeyPressListener, VclWindowEvent&, rEvent, void)
{
if (rEvent.GetId() != VclEventId::WindowKeyInput)
return;
const KeyEvent& rKeyEvent = *static_cast<KeyEvent*>(rEvent.GetData());
sal_uInt16 nKeyCode = rKeyEvent.GetKeyCode().GetCode();
if (nKeyCode == KEY_UP || nKeyCode == KEY_DOWN || nKeyCode == KEY_PAGEUP || nKeyCode == KEY_PAGEDOWN)
{
m_pTreeView->disable_notify_events();
ListBox& rListBox = m_pTreeView->getTreeView();
NotifyEvent aNotifyEvt(MouseNotifyEvent::KEYINPUT, reinterpret_cast<vcl::Window*>(rListBox.mpImplWin.get()), &rKeyEvent);
rListBox.PreNotify(aNotifyEvt);
m_xEntry->set_text(m_xTreeView->get_selected_text());
m_xEntry->select_region(0, -1);
m_pTreeView->enable_notify_events();
m_pEntry->fire_signal_changed();
}
}
IMPL_LINK(SalInstanceEntryTreeView, AutocompleteHdl, Edit&, rEdit, void)
{
Selection aSel = rEdit.GetSelection();
@@ -2512,10 +2607,11 @@
return pListBox ? o3tl::make_unique<SalInstanceComboBoxTextWithoutEdit>(pListBox, bTakeOwnership) : nullptr;
}
virtual std::unique_ptr<weld::EntryTreeView> weld_entry_tree_view(const OString& entryid, const OString& treeviewid, bool bTakeOwnership) override
virtual std::unique_ptr<weld::EntryTreeView> weld_entry_tree_view(const OString& containerid, const OString& entryid, const OString& treeviewid, bool bTakeOwnership) override
{
return o3tl::make_unique<SalInstanceEntryTreeView>(weld_entry(entryid, bTakeOwnership),
weld_tree_view(treeviewid, bTakeOwnership));
vcl::Window* pContainer = m_xBuilder->get<vcl::Window>(containerid);
return pContainer ? o3tl::make_unique<SalInstanceEntryTreeView>(pContainer, bTakeOwnership, weld_entry(entryid, bTakeOwnership),
weld_tree_view(treeviewid, bTakeOwnership)) : nullptr;
}
virtual std::unique_ptr<weld::TreeView> weld_tree_view(const OString &id, bool bTakeOwnership) override
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 1aac3df..3e16f2c 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -57,6 +57,7 @@
bool m_isSyntheticModify : 1;
bool m_isMatchCase : 1;
sal_Int32 m_nMaxWidthChars;
sal_Int32 m_nWidthInChars;
Link<ComboBox&,void> m_SelectHdl;
Link<ComboBox&,void> m_DoubleClickHdl;
@@ -68,6 +69,7 @@
, m_isSyntheticModify(false)
, m_isMatchCase(false)
, m_nMaxWidthChars(0)
, m_nWidthInChars(-1)
{
}
@@ -141,6 +143,7 @@
m_isMatchCase = false;
m_cMultiSep = ';';
m_nMaxWidthChars = -1;
m_nWidthInChars = -1;
}
void ComboBox::ImplCalcEditHeight()
@@ -1049,7 +1052,11 @@
else
{
aSz.setHeight( Edit::CalcMinimumSizeForText(GetText()).Height() );
aSz.setWidth( m_pImpl->m_pImplLB->GetMaxEntryWidth() );
if (m_pImpl->m_nWidthInChars!= -1)
aSz.setWidth(m_pImpl->m_nWidthInChars * approximate_digit_width());
else
aSz.setWidth(m_pImpl->m_pImplLB->GetMaxEntryWidth());
}
if (m_pImpl->m_nMaxWidthChars != -1)
@@ -1499,6 +1506,15 @@
return aBounds;
}
void ComboBox::SetWidthInChars(sal_Int32 nWidthInChars)
{
if (nWidthInChars != m_pImpl->m_nWidthInChars)
{
m_pImpl->m_nWidthInChars = nWidthInChars;
queue_resize();
}
}
void ComboBox::setMaxWidthChars(sal_Int32 nWidth)
{
if (nWidth != m_pImpl->m_nMaxWidthChars)
@@ -1510,7 +1526,9 @@
bool ComboBox::set_property(const OString &rKey, const OUString &rValue)
{
if (rKey == "max-width-chars")
if (rKey == "width-chars")
SetWidthInChars(rValue.toInt32());
else if (rKey == "max-width-chars")
setMaxWidthChars(rValue.toInt32());
else
return Control::set_property(rKey, rValue);
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 2ca2976..b22ef47 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -148,9 +148,9 @@
return ImplGetSVData()->mpDefInst->GetFrameWeld(rWindow);
}
namespace
namespace weld
{
const OUString MetricToString(FieldUnit rUnit)
OUString MetricSpinButton::MetricToString(FieldUnit rUnit)
{
FieldUnitStringList* pList = ImplGetFieldUnits();
if (pList)
@@ -165,10 +165,7 @@
return OUString();
}
}
namespace weld
{
IMPL_LINK_NOARG(MetricSpinButton, spin_button_value_changed, SpinButton&, void)
{
signal_value_changed();
@@ -344,6 +341,7 @@
IMPL_LINK(EntryTreeView, ClickHdl, weld::TreeView&, rView, void)
{
m_xEntry->set_text(rView.get_selected_text());
m_aChangeHdl.Call(*this);
}
void EntryTreeView::EntryModifyHdl(weld::Entry& rBox)
@@ -374,13 +372,13 @@
IMPL_LINK(EntryTreeView, ModifyHdl, weld::Entry&, rBox, void)
{
EntryModifyHdl(rBox);
m_aChangeHdl.Call(rBox);
m_aChangeHdl.Call(*this);
}
void EntryTreeView::set_size_request_by_digits_rows(int nDigits, int nRows)
void EntryTreeView::set_height_request_by_rows(int nRows)
{
m_xTreeView->set_size_request(m_xTreeView->get_approximate_digit_width() * nDigits,
m_xTreeView->get_height_rows(nRows));
int nHeight = nRows == -1 ? -1 : m_xTreeView->get_height_rows(nRows);
m_xTreeView->set_size_request(-1, nHeight);
}
}
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 871785d..f93b598 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -378,7 +378,7 @@
namespace
{
void ClipboardGetFunc(GtkClipboard */*clipboard*/, GtkSelectionData *selection_data,
void ClipboardGetFunc(GtkClipboard* /*clipboard*/, GtkSelectionData *selection_data,
guint info,
gpointer user_data_or_owner)
{
@@ -386,13 +386,13 @@
pThis->ClipboardGet(selection_data, info);
}
void ClipboardClearFunc(GtkClipboard */*clipboard*/, gpointer user_data_or_owner)
void ClipboardClearFunc(GtkClipboard* /*clipboard*/, gpointer user_data_or_owner)
{
VclGtkClipboard* pThis = static_cast<VclGtkClipboard*>(user_data_or_owner);
pThis->ClipboardClear();
}
void handle_owner_change(GtkClipboard *clipboard, GdkEvent */*event*/, gpointer user_data)
void handle_owner_change(GtkClipboard *clipboard, GdkEvent* /*event*/, gpointer user_data)
{
VclGtkClipboard* pThis = static_cast<VclGtkClipboard*>(user_data);
pThis->OwnerPossiblyChanged(clipboard);
@@ -3405,6 +3405,14 @@
return gtk_editable_get_editable(GTK_EDITABLE(m_pEntry));
}
virtual void set_error(bool bError) override
{
if (bError)
gtk_entry_set_icon_from_icon_name(m_pEntry, GTK_ENTRY_ICON_SECONDARY, "dialog-error");
else
gtk_entry_set_icon_from_icon_name(m_pEntry, GTK_ENTRY_ICON_SECONDARY, nullptr);
}
virtual void disable_notify_events() override
{
g_signal_handler_block(m_pEntry, m_nInsertTextSignalId);
@@ -3501,6 +3509,11 @@
pango_attr_list_unref(pAttrList);
}
void fire_signal_changed()
{
signal_changed();
}
virtual ~GtkInstanceEntry() override
{
g_signal_handler_disconnect(m_pEntry, m_nCursorPosSignalId);
@@ -4773,6 +4786,11 @@
gtk_tree_sortable_set_sort_column_id(pSortable, 0, GTK_SORT_ASCENDING);
}
virtual bool has_entry() const override
{
return gtk_combo_box_get_has_entry(GTK_COMBO_BOX(m_pComboBoxText));
}
virtual void set_entry_error(bool bError) override
{
GtkWidget* pChild = gtk_bin_get_child(GTK_BIN(m_pComboBoxText));
@@ -4794,6 +4812,14 @@
enable_notify_events();
}
virtual void set_entry_width_chars(int nChars) override
{
GtkWidget* pChild = gtk_bin_get_child(GTK_BIN(m_pComboBoxText));
assert(pChild && GTK_IS_ENTRY(pChild));
GtkEntry* pEntry = GTK_ENTRY(pChild);
gtk_entry_set_width_chars(pEntry, nChars);
}
virtual void select_entry_region(int nStartPos, int nEndPos) override
{
GtkWidget* pChild = gtk_bin_get_child(GTK_BIN(m_pComboBoxText));
@@ -4871,6 +4897,83 @@
}
};
class GtkInstanceEntryTreeView : public GtkInstanceContainer, public virtual weld::EntryTreeView
{
private:
GtkInstanceEntry* m_pEntry;
GtkInstanceTreeView* m_pTreeView;
gulong m_nKeyPressSignalId;
gboolean signal_key_press(GdkEventKey* pEvent)
{
if (pEvent->keyval == GDK_KEY_KP_Up || pEvent->keyval == GDK_KEY_Up || pEvent->keyval == GDK_KEY_KP_Page_Up || pEvent->keyval == GDK_KEY_Page_Up ||
pEvent->keyval == GDK_KEY_KP_Down || pEvent->keyval == GDK_KEY_Down || pEvent->keyval == GDK_KEY_KP_Page_Down || pEvent->keyval == GDK_KEY_Page_Down)
{
gboolean ret;
m_pTreeView->disable_notify_events();
GtkWidget* pWidget = m_pTreeView->getWidget();
gtk_widget_grab_focus(pWidget);
g_signal_emit_by_name(pWidget, "key-press-event", pEvent, &ret);
m_xEntry->set_text(m_xTreeView->get_selected_text());
gtk_widget_grab_focus(m_pEntry->getWidget());
m_xEntry->select_region(0, -1);
m_pTreeView->enable_notify_events();
m_pEntry->fire_signal_changed();
return true;
}
return false;
}
static gboolean signalKeyPress(GtkWidget*, GdkEventKey* pEvent, gpointer widget)
{
GtkInstanceEntryTreeView* pThis = static_cast<GtkInstanceEntryTreeView*>(widget);
return pThis->signal_key_press(pEvent);
}
public:
GtkInstanceEntryTreeView(GtkContainer* pContainer, bool bTakeOwnership, std::unique_ptr<weld::Entry> xEntry, std::unique_ptr<weld::TreeView> xTreeView)
: EntryTreeView(std::move(xEntry), std::move(xTreeView))
, GtkInstanceContainer(pContainer, bTakeOwnership)
, m_pEntry(dynamic_cast<GtkInstanceEntry*>(m_xEntry.get()))
, m_pTreeView(dynamic_cast<GtkInstanceTreeView*>(m_xTreeView.get()))
{
assert(m_pEntry);
GtkWidget* pWidget = m_pEntry->getWidget();
m_nKeyPressSignalId = g_signal_connect(pWidget, "key-press-event", G_CALLBACK(signalKeyPress), this);
}
virtual void make_sorted() override
{
GtkWidget* pTreeView = m_pTreeView->getWidget();
GtkTreeModel* pModel = gtk_tree_view_get_model(GTK_TREE_VIEW(pTreeView));
GtkTreeSortable* pSortable = GTK_TREE_SORTABLE(pModel);
gtk_tree_sortable_set_sort_column_id(pSortable, 1, GTK_SORT_ASCENDING);
}
virtual void set_entry_completion(bool bEnable) override
{
assert(!bEnable && "not implemented yet"); (void)bEnable;
gtk_entry_set_completion(GTK_ENTRY(m_pEntry->getWidget()), nullptr);
}
virtual void connect_focus_in(const Link<Widget&, void>& rLink) override
{
m_xEntry->connect_focus_in(rLink);
}
virtual void connect_focus_out(const Link<Widget&, void>& rLink) override
{
m_xEntry->connect_focus_out(rLink);
}
virtual ~GtkInstanceEntryTreeView() override
{
GtkWidget* pWidget = m_pEntry->getWidget();
g_signal_handler_disconnect(pWidget, m_nKeyPressSignalId);
}
};
class GtkInstanceExpander : public GtkInstanceContainer, public virtual weld::Expander
{
private:
@@ -5353,9 +5456,13 @@
return o3tl::make_unique<GtkInstanceTreeView>(pTreeView, bTakeOwnership);
}
virtual std::unique_ptr<weld::EntryTreeView> weld_entry_tree_view(const OString& entryid, const OString& treeviewid, bool bTakeOwnership) override
virtual std::unique_ptr<weld::EntryTreeView> weld_entry_tree_view(const OString& containerid, const OString& entryid, const OString& treeviewid, bool bTakeOwnership) override
{
return o3tl::make_unique<weld::EntryTreeView>(weld_entry(entryid, bTakeOwnership), weld_tree_view(treeviewid, bTakeOwnership));
GtkContainer* pContainer = GTK_CONTAINER(gtk_builder_get_object(m_pBuilder, containerid.getStr()));
if (!pContainer)
return nullptr;
auto_add_parentless_widgets_to_container(GTK_WIDGET(pContainer));
return o3tl::make_unique<GtkInstanceEntryTreeView>(pContainer, bTakeOwnership, weld_entry(entryid, bTakeOwnership), weld_tree_view(treeviewid, bTakeOwnership));
}
virtual std::unique_ptr<weld::Label> weld_label(const OString &id, bool bTakeOwnership) override